HTML画圆,三角形,六边形

来源:互联网 发布:js中的target属性 编辑:程序博客网 时间:2024/06/06 00:01
画圆:首先建个div,然后把div的宽高设置同样大小,最后把div的边框弧度设为50%;
.circleOne{      width: 300px;      height: 300px;      border-radius: 50%;      border: 5px solid blue;  }  

画三角形:首先建个div,然后把div宽高设为0,再给边框设置大小(根据自己的需求设置需要的那几条边框),边框颜色为透明,最后给任意一条边框设置颜色,
.triangle {      height: 0px;      width: 0px;      border: 20px solid transparent;      border-right-color:#DE1955;  }  
画六边形:建三个div,两个为三角形,一个为矩形,自己注意调整宽高
.triangle {height: 0px;width: 0px;border: 60px solid transparent;border-bottom-color:#DE1955;} .rectangle{ height: 60px; width: 120px;    background-color: #DE1955; } .triangleTWO {height: 0px;width: 0px;border: 60px solid transparent;border-top-color:#DE1955;}

原创粉丝点击