码迷,mamicode.com
首页 > Web开发 > 详细

用CSS画五角星

时间:2016-07-03 21:51:02      阅读:893      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>五角星</title>
<style>
#star-five {
margin: 50px;
position: relative;
display: block;
color: red;
width: 0;
height: 0;
border-right: 100px solid transparent;
border-bottom: 70px solid red;
border-left: 100px solid transparent;
/*-moz-transform: rotate(35deg);*/
/*-webkit-transform: rotate(35deg);*/
/*-ms-transform: rotate(35deg);*/
/*-o-transform: rotate(35deg);*/
transform: rotate(35deg);
}
#star-five:before {
border-bottom: 80px solid red;
border-left: 30px solid transparent;
border-right: 30px solid transparent;
position: absolute;
height: 0;
width: 0;
top: -45px;
left: -65px;
display: block;
/*下面这条代码是必须的,表示在#star-five盒子之前插入一个非空的盒子*/
content: ‘‘;
-webkit-transform: rotate(-35deg);
-moz-transform: rotate(-35deg);
-ms-transform: rotate(-35deg);
-o-transform: rotate(-35deg);

}
#star-five:after {
position: absolute;
display: block;
color: red;
top: 3px;
left: -105px;
width: 0;
height: 0;
border-right: 100px solid transparent;
border-bottom: 70px solid red;
border-left: 100px solid transparent;
-webkit-transform: rotate(-70deg);
-moz-transform: rotate(-70deg);
-ms-transform: rotate(-70deg);
-o-transform: rotate(-70deg);
content: ‘‘;
}

</style>
</head>
<body>
<div id="star-five"></div>
</body>
</html>

用CSS画五角星

标签:

原文地址:http://www.cnblogs.com/webbest/p/5638777.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!