首页 > Web开发 > 详细

用CSS画五角星

时间:2016-07-03 21:49:51      阅读:477      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!