一、三角形
1、CSS画等腰三角形
2、画直角三角形:
二、画圆形
注意:border-radius是width/height的一半(50%)。
画半圆:
半圆的画法是把高度设为宽度的一半,并且也只设置左上角和右上角的半径,且半径为宽度的一半。
画四分之一圆:是把高度和宽度设置为相等,只设置一个圆角,其半径等于高度或宽度。
三、画椭圆
斜杠前面的一组四个值分别表示四个角的水平半径;斜杠后面的一组四个值分别表示四个角的垂直半径。
四、平行四边形
margin-left是为了使得平行四边形可以全部在浏览器中显示出来
五、梯形
高度为0。有宽度没高度。
六、五边形、六边形
<div class="arrow-up"><!--向上的三角--></div><div class="arrow-down"><!--向下的三角--></div>
<div class="arrow-left"><!--向左的三角--></div>
<div class="arrow-right"><!--向右的三角--></div>
CSS
/*向上的三角*/.arrow-up {
width:0
height:0
border-left:30px solid transparent
border-right:30px solid transparent
border-bottom:30px solid #fff
}
/*箭头向下*/
.arrow-down {
width:0
height:0
border-left:20px solid transparent
border-right:20px solid transparent
border-top:20px solid #0066cc
}
/*箭头向左*/
.arrow-left {
width:0
height:0
border-top:30px solid transparent
border-bottom:30px solid transparent
border-right:30px solid yellow
}
/*箭头向右*/
.arrow-right {
width:0
height:0
border-top:50px solid transparent
border-bottom: 50px solid transparent
border-left: 50px solid green
}