我得到了以下代码: https://css-tricks.com/examples/ShapesOfCSS/
我想让这颗星更小。我尝试改变高度和宽度,但没有任何反应,我将如何实现这一目标?
我做了这个http://jsfiddle.net/YXe3k/
.star-five {
margin: 50px 0;
position: relative;
display: block;
color: red;
width: 0px;
height: 0px;
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);
}
.star-five:before {
border-bottom: 80px solid red;
border-left: 30px solid transparent;
border-right: 30px solid transparent;
position: absolute;
height: 10px;
width: 0;
top: -45px;
left: -65px;
display: block;
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: 0px;
height: 0px;
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: '';
}
答案 0 :(得分:5)
除了现有的旋转变换之外,一种简单的方法是使用CSS缩放变换:
-moz-transform: rotate(35deg) scale(.5);
-webkit-transform: rotate(35deg) scale(.5);
-ms-transform: rotate(35deg) scale(.5);
-o-transform: rotate(35deg) scale(.5);
<强> jsFiddle example 强>