当前第2页 返回上一页
方法二:也是把正六边形分成三个宽高相同的div,然后使用定位以及css3 transform:rotate分别向左右旋转60deg形成正六边形,如图:

html代码:
1 2 3 4 5 | <div style= 'position:relative;width:100px;margin:0 auto;' >
<div class = 'one' ></div>
<div class = 'two' ></div>
<div class = 'three' ></div>
</div>
|
css代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | .one {
width: 50px;
height: 86.6px;
margin: 0 auto;
border-top: 1px solid red;
border-bottom: 1px solid red;
}
.two {
position: absolute;
width: 50px;
height: 86.6px;
left: 25px;
top: 0;
transform: translate(-50%,-50%);
transform: rotate(60deg);
border-top: 1px solid red;
border-bottom: 1px solid red;
}
.three {
position: absolute;
width: 50px;
height: 86.6px;
left: 25px;
top: 0;
transform: translate(-50%,-50%);
transform: rotate(300deg);
border-top: 1px solid red;
border-bottom: 1px solid red;
}
|
以上就是css六边形怎么画的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
使用html+css制作一些动画提示工具
css怎么让首行文字缩进
值得收藏的26个css面试题,增强你的css基础!
css中px、em、rem的区别是什么?
css如何实现图片抽屉式效果
css中的content属性该如何使用
4种移动端适配方法
css如何改变文本框颜色
css如何实现下拉菜单
jsp怎么导入css
更多相关阅读请进入《css》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » css六边形怎么画