分享一段代码实例, 它实现了六角形效果.
代码实例如下:
- <!doctype html>
- <HTML>
- <head>
- <meta charset="utf-8">
- <meta name="author" content="[网页链接](http://www.softwhy.com/%22) />
- <title > 蚂蚁部落 </title>
- <style type=" text/CSS ">
- #six {
- width: 0;
- height: 0;
- border-left: 60px solid transparent;
- border-right: 60px solid transparent;
- border-bottom: 120px solid red;
- position: relative;
- }
- #six:after {
- content: " ";
- width: 0;
- height: 0;
- border-left: 60px solid transparent;
- border-right: 60px solid transparent;
- border-top: 120px solid red;
- position: absolute;
- top: 40px;
- left: -60px;
- }
- .six {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%,-50%);
- }
- </style>
- </head>
- <body>
- <div class="six ">
- <div id="six
- "></div>
- </div>
- </body>
- </HTML>
最后, 给大家推荐一个前端学习进阶内推交流群 685910553(前端资料分享), 不管你在地球哪个方位,
不管你参加工作几年都欢迎你的入驻!(群内会定期免费提供一些群主收藏的免费学习书籍资料以及整理好的面试题和答案文档!)
如果您对这个文章有任何异议, 那么请在文章评论处写上你的评论.
如果您觉得这个文章有意思, 那么请分享并转发, 或者也可以关注一下表示您对我们文章的认可与鼓励.
愿大家都能在编程这条路, 越走越远.
来源: http://www.jianshu.com/p/880a2de0e9b8