大佬教程收集整理的这篇文章主要介绍了html – 如何制作一个octogonal div?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
如何创建八角形div?
#octagon { width: 100px; height: 100px; BACkground: red; position: relative; } #octagon:before { content: ""; position: absolute; top: 0; left: 0; border-bottom: 29px solid red; border-left: 29px solid #eee; border-right: 29px solid #eee; width: 42px; height: 0; } #octagon:after { content: ""; position: absolute; bottom: 0; left: 0; border-top: 29px solid red; border-left: 29px solid #eee; border-right: 29px solid #eee; width: 42px; height: 0; }
它由div元素本身构成,它具有矩形形状.使用:before和:after伪类,添加内容以创建两个完成八边形的梯形.巧妙地,这通过使用CSS的funkier位将实际标签数量保持为一.
该技术的起源可以在here找到.
Here is a quick demo.蓝色部分是:在CSS之前,绿色是:在CSS之后.甚至更好,here is a demo允许透明背景! (谢谢你@GGG).
以上是大佬教程为你收集整理的html – 如何制作一个octogonal div?全部内容,希望文章能够帮你解决html – 如何制作一个octogonal div?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。