首頁  >  問答  >  主體

html5 - CSS画五角星画的不正

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>2-3</title>
    <style type="text/css">
    *{
        margin: 0;padding: 0;
    }
        .backgroundOne{
            width:300px;
            height:200px;
            background-color:#f00;
            border-radius: 15px;
        }

        .backgroundOne > p {
            width: 0px;
            height: 0px;
            border-right:  100px solid transparent;
            border-bottom:  70px solid #ff0;
            border-left:   100px solid transparent;

            -webkit-transform: rotate(35deg);
               -moz-transform: rotate(35deg);
                -ms-transform: rotate(35deg);
                 -o-transform: rotate(35deg);
                    transform: rotate(35deg);
                    
        }

        .backgroundOne > p::after{
            width: 0px;
            height: 0px;
            display: block;
            border-right: 100px solid transparent;
            border-bottom: 70px solid #ff0;
            border-left: 100px solid transparent;
            content: '';
            -webkit-transform: rotate(-70deg) translate(29px,-130px);
               -moz-transform: rotate(-70deg) translate(29px,-130px);
                -ms-transform: rotate(-70deg) translate(29px,-130px);
                 -o-transform: rotate(-70deg) translate(29px,-130px);
                    transform: rotate(-70deg) translate(29px,-130px);

        }
        .backgroundOne > p::before{
            height: 0px;
            width: 0px;
            display: block;
            content: '';
            border-right: 30px solid transparent;
            border-bottom: 80px solid #ff0;
            border-left: 30px solid transparent;
           -webkit-transform: rotate(-35deg) translate(-30px,-80px);
               -moz-transform: rotate(-35deg) translate(-30px,-80px);
                -ms-transform: rotate(-35deg) translate(-30px,-80px);
                 -o-transform: rotate(-35deg) translate(-30px,-80px);
                    transform: rotate(-35deg) translate(-30px,-80px);                                       
        }

        .backgroundOne > p:nth-child(1) {transform: translate(-50px,  20px)  rotate(35deg) scale(0.3,0.3);}
        .backgroundOne > p:nth-child(2) {transform: translate(  0px, -80px)  rotate(60deg) scale(0.1,0.1);}
        .backgroundOne > p:nth-child(3) {transform: translate( 22px, -125px) rotate(80deg) scale(0.1,0.1);}
        .backgroundOne > p:nth-child(4) {transform: translate( 22px, -162px) rotate(35deg) scale(0.1,0.1);}
        .backgroundOne > p:nth-child(5) {transform: translate(  0px, -210px) rotate(65deg) scale(0.1,0.1);}

    </style>
</head>
<body>
<p class="backgroundOne">
    <p></p>
    <p></p>
    <p></p>
    <p></p>
    <p></p>
</p>
</body>
</html>

各位大神指点下,这个五角星为何不正。

ringa_leeringa_lee2765 天前577

全部回覆(1)我來回復

  • 大家讲道理

    大家讲道理2017-04-17 14:59:08

    感覺也有點不太正...

    回覆
    0
  • 取消回覆