一、三角形
1、CSS画等腰三角形
2、画直角三角形:
二、画圆形
注意:border-radius是width/height的一半(50%)。
画半圆:
半圆的画法是把高度设为宽度的一半,并且也只设置左上角和右上角的半径,且半径为宽度的一半。
画四分之一圆:是把高度和宽度设置为相等,只设置一个圆角,其半径等于高度或宽度。
三、画椭圆
斜杠前面的一组四个值分别表示四个角的水平半径;斜杠后面的一组四个值分别表示四个角的垂直半径。
四、平行四边形
margin-left是为了使得平行四边形可以全部在浏览器中显示出来
五、梯形
高度为0。有宽度没高度。
六、五边形、六边形
1、理论
三角形实现原理:宽度width为0;height为0;
(1)有一条横竖边(上下左右)的设置为border-方向:长度 solid red,这个画的就是底部的直线。其他边使用border-方向:长度 solid transparent。
(2)有两个横竖边(上下左右)的设置,若斜边是在三角形的右边,这时候设置top或bottom的直线,和右边的斜线。若斜边是在三角形的左边,这时候设置top或bottom的直线,和左边的斜线。
二、实现
2.1 Triangle Up
#triangle-up {width:0 height:0
border-left:50px solid transparent
border-right:50px solid transparent
border-bottom:100px solid red}
2.2 Triangle Down
#triangle-down {width:0 height:0
border-left:50px solid transparent
border-right:50px solid transparent
border-top:100px solid red}
2.3 Triangle Left
#triangle-left {
width:0
height:0
border-top:50px solid transparent
border-right:100px solid red
border-bottom:50px solid transparent}
2.4 Triangle Right
#triangle-right {width:0
height:0
border-top:50px solid transparent
border-left:100px solid red
border-bottom:50px solid transparent}
2.5 Triangle Top Left
#triangle-topleft {width:0
height:0
border-top:100px solid red
border-right:100px solid transparent}
2.6 Triangle Top Right
#triangle-topright {width:0
height:0
border-top:100px solid red
border-left:100px solid transparent}
2.7 Triangle Bottom Left
#triangle-bottomleft {width:0
height:0
border-bottom:100px solid red
border-right:100px solid transparent}
2.8 Triangle Bottom Right
#triangle-bottomright {width:0
height:0
border-bottom:100px solid red
border-left:100px solid transparent}
可以使用HTML 的<del>标签,代码如下:
比如拍卖XX原价<del>30</del>元 现价28元。效果如下:
del标签说明:
定义和用法
定义文档中已被删除的文本。
可选的属性
属性 值 描述
cite URL 指向另外一个文档的 URL,此文档可解释文本被删除的原因。
datetime YYYYMMDD 定义文本被删除的日期和时间。