css怎么做斜线

html-css011

css怎么做斜线,第1张

代码已经测试,兼容主流浏览器:

<style>

.line{

width:100pxheight:25pxborder-bottom:1px solid #333

filter: progid:DXImageTransform.Microsoft.BasicImage(Rotation=0.45)/*IE*/

-moz-transform: rotate(45deg)/*Firefox*/

-webkit-transform: rotate(45deg)/*Safari,Chrome*/

}

</style>

<div class="line"></div>

1、起到注释的作用,里面的内容是说明该段css的情况的。

例如:#header{height: 50px} /*-- header头部 --*/

其中的/*-- header头部 --*/ 是注释说明这个css是控制头部的,一个说明的作用。

2、还有就是可以把某段暂时不需要作用的css代码给注释掉,让它不起作用。

<style>

.box{

width: 25px

height: 25px

border: 1px black solid

}

.box:after{

width: 35.25px

content: ""

display: block

height: 25px

border-bottom: 1px black solid

transform: rotate(-45deg)

transform-origin: left bottom

}

</style>

</head>

<body>

<div class="box">

</div>

</body>

如果是长方形角度得算一下