>  기사  >  웹 프론트엔드  >  用div+css实现三角形,三角形内有字_html/css_WEB-ITnose

用div+css实现三角形,三角形内有字_html/css_WEB-ITnose

WBOY
WBOY원래의
2016-06-24 12:25:541863검색

用div+css实现三角形,三角形内有字
如下图:


回复讨论(解决方案)

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style type="text/css">.a{	border-bottom:1px solid #aaa;	height:50px;	width:100px;	position:relative;	overflow:hidden;}.b{	position:absolute;	display:block;	top:0px;	left:0px;	width:100px;	height:50px;}.b i,.b em{	position:absolute;	left:0px;	bottom:0px;	border-color:transparent;	border-color:rgba(255,255,255,0);	border-style:solid;	border-width:0 50px 50px 50px;}.b i{	border-bottom-color:#aaa;}.b em{	border-bottom-color:#FFF;	bottom:-1px;}.text{	position:absolute;	bottom:10px;	background:none;	border:none;	outline:none;	text-align:center;	width:100%;}</style></head><body><div class = "a">	<span class = "b">		<i></i>		<em></em>	</span>	<input type = "text" value = "文字" class = "text"/></div></body></html>


用定位模拟呢的,试试看哦。

用定位模拟呢的,试试看哦。



比下面这个好!

<style type="text/css">   .topdirection  {   font-size:0;     width:0;height:0;      line-height:0;      border-width:100px;      border-style:solid;      border-color: transparent transparent #A9DBF6 transparent;  }  </style>  <div><div  class="topdirection"></div>  <div style="margin:-50px 0px 0px 90px;">重点</div></div>

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.