欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

正六边形的 CSS 实现

最编程 2024-04-06 12:50:10
...
<html> <head> <style> #dec { width: 173px; height: 100px; border-left:1px solid red; border-right:1px solid red; position: relative; } #dec:before { content: ""; position: absolute; top: 0; left: -1px; width: 173px; height: 100px; border-left:1px solid green; border-right:1px solid green; transform: rotate(60deg); } #dec:after { content: ""; position: absolute; top: 0; left: -1px; width: 173px; height: 100px; border-left:1px solid blue; border-right:1px solid blue; transform: rotate(120deg); } </style> </head> <body> <div id="dec"></div> </body> </html>