当前位置:首页 > 网页设计 >CSS >

28个纯CSS画图代码分享

发布时间:2016-01-27 09:46:31 作者:佚名 阅读:(746)

12、CSS右下三角

CSS代码如下:

 

#triangle-bottomright {
    width: 0;
    height: 0;
    border-bottom: 100pxsolidred; 
    border-left: 100pxsolidtransparent;
}

 

13、CSS平行四边形

CSS代码如下:

 

#parallelogram {
    width: 150px;
    height: 100px;
        margin-left:20px;
    -webkit-transform: skew(20deg);
       -moz-transform: skew(20deg);
         -o-transform: skew(20deg);
    background: red;
}

 

14、CSS梯形

CSS代码如下:

 

#trapezoid {
    border-bottom: 100pxsolidred;
    border-left: 50pxsolidtransparent;
    border-right: 50pxsolidtransparent;
    height: 0;
    width: 100px;
}

 

15、CSS六角星

CSS代码如下:

 

#star-six {
    width: 0;
    height: 0;
    border-left: 50pxsolidtransparent;
    border-right: 50pxsolidtransparent;
    border-bottom: 100pxsolidred;
    position: relative;
}
#star-six:after {
    width: 0;
    height: 0;
    border-left: 50pxsolidtransparent;
    border-right: 50pxsolidtransparent;
    border-top: 100pxsolidred;
    position: absolute;
    content: "";
    top: 30px;
    left: -50px;
}

 

16、CSS五角星

CSS代码如下:

 

#star-five {
   margin: 50px0;
   position: relative;
   display: block;
   color: red;
   width: 0px;
   height: 0px;
   border-right:  100pxsolidtransparent;
   border-bottom: 70px  solidred;
   border-left:   100pxsolidtransparent;
   -moz-transform:    rotate(35deg);
   -webkit-transform: rotate(35deg);
   -ms-transform:     rotate(35deg);
   -o-transform:      rotate(35deg);
}
#star-five:before {
   border-bottom: 80pxsolidred;
   border-left: 30pxsolidtransparent;
   border-right: 30pxsolidtransparent;
   position: absolute;
   height: 0;
   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: 100pxsolidtransparent;
   border-bottom: 70pxsolidred;
   border-left: 100pxsolidtransparent;
   -webkit-transform: rotate(-70deg);
   -moz-transform:    rotate(-70deg);
   -ms-transform:     rotate(-70deg);
   -o-transform:      rotate(-70deg);
   content: '';
}

 

17、CSS五角大楼

CSS代码如下:

 

#pentagon {
    position: relative;
    width: 54px;
    border-width: 50px18px0;
    border-style: solid;
    border-color: redtransparent;
}
#pentagon:before {
    content: "";
    position: absolute;
    height: 0;
    width: 0;
    top: -85px;
    left: -18px;
    border-width: 045px35px;
    border-style: solid;
    border-color: transparenttransparentred;
}

 

18、CSS六边形

CSS代码如下:

 

#hexagon {
    width: 100px;
    height: 55px;
    background: red;
    position: relative;
}
#hexagon:before {
    content: "";
    position: absolute;
    top: -25px; 
    left: 0;
    width: 0;
    height: 0;
    border-left: 50pxsolidtransparent;
    border-right: 50pxsolidtransparent;
    border-bottom: 25pxsolidred;
}
#hexagon:after {
    content: "";
    position: absolute;
    bottom: -25px; 
    left: 0;
    width: 0;
    height: 0;
    border-left: 50pxsolidtransparent;
    border-right: 50pxsolidtransparent;
    border-top: 25pxsolidred;
}

欢迎分享转载→ 28个纯CSS画图代码分享

© 2015-2019 - 吾爱编程网 版权所有 苏ICP备18033726号-1关于我们 - 网站声明 - 联系我们