css怎么做斜线

html-css024

css怎么做斜线,第1张

<style>

#book{

width:300pxheight:20pxborder-bottom:2px solid #000000

-webkit-transform: rotate(45deg)/*Safari 4+,Google Chrome 1+  */

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

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

}

</style>

<div id="book">

</div>

当然方法还有很多种,比如用满边框,再在上面叠加一个小一点的满边框就出来斜线了。

1、打开html开发软件工具,新建一个html代码页面,创建一个<div>,同时给这个<div>添加一些文本内容和一个class类为 oblique。

2、使用font-style: oblique设置字体倾斜。创建<style>标签,然后在这个标签里面设置oblique类font-style属性为oblique。

代码:

<style>

.oblique{

font-style: oblique

}

</style>

3、最后,可以用链接打开可以看到已经倾斜45度,就是上面的代码编写即可。