制作圆形:

要使用CSS来制作一个圆形,我们需要一个div,被给它设置一个ID

<div id="circle"></div> 

圆形在设置CSS时要设置宽度和高度相等,然后设置border-radius属性为宽度或高度的一半即可:

#circle {

    width: 120px;

    height: 120px;

    background: #7fee1d;

    -moz-border-radius: 60px;

    -webkit-border-radius: 60px;

    border-radius: 60px;

制作椭圆形:

椭圆形是正圆形的一个变体,同样使用一个带ID的div来制作

<div id="oval"></div>

设置椭圆形的CSS时,高度要设置为宽度的一半,border-radius属性也要做相应的改变:

#oval {

    width: 200px;

    height: 100px;

    background: #e9337c;

    -webkit-border-radius: 100px / 50px;

    -moz-border-radius: 100px / 50px;

    border-radius: 100px / 50px;

制作三角形:

要创建一个CSS三角形,需要使用border,通过设置不同边的透明效果,我们可以制作出三角形的现状。另外,在制作三角形时,宽度和高度要设置为0。

<div id="triangle"></div>  

                           

#triangle {

    width: 0;

    height: 0;

    border-bottom: 140px solid #fcf921;

    border-left: 70px solid transparent;

    border-right: 70px solid transparent;

}   

制作倒三角形:

与正三角形不同的是,倒三角形要设置的是border-top、border-left和border-right三条边的属性:

#triangle {

    width: 0;

    height: 0;

    border-top: 140px solid #20a3bf;

    border-left: 70px solid transparent;

    border-right: 70px solid transparent;

  1. 制作左三角形:
  2. 左三角形操作的是border-top、border-left和border-right三条边的属性,其中上边和下边要设置透明属性。
  3. #triangle_left {
  4.     width: 0;
  5.     height: 0;
  6.     border-top: 70px solid transparent;
  7.     border-right: 140px solid #6bbf20;
  8.     border-bottom: 70px solid transparent;
  9. }  
  10. 6

    制作菱形

    制作菱形的方法有很多种。这里使用的是transform属性和rotate相结合,使两个正反三角形上下显示。

    #diamond {

        width: 120px;

        height: 120px;

        background: #1eff00;

    /* Rotate */

        -webkit-transform: rotate(-45deg);

        -moz-transform: rotate(-45deg);

        -ms-transform: rotate(-45deg);

        -o-transform: rotate(-45deg);

        transform: rotate(-45deg);

    /* Rotate Origin */

        -webkit-transform-origin: 0 100%;

        -moz-transform-origin: 0 100%;

        -ms-transform-origin: 0 100%;

        -o-transform-origin: 0 100%;

        transform-origin: 0 100%;

        margin: 60px 0 10px 310px;

  11. 7

    制作梯形:

    梯形是三角形的一个变体,设置CSS梯形时,左右两条边设置为相等,并且给它设置一个宽度。

    #trapezium {

        height: 0;

        width: 120px;

        border-bottom: 120px solid #ec3504;

        border-left: 60px solid transparent;

        border-right: 60px solid transparent;

  12. 8

    制作平行四边形:

    平行四边形的制作方式是使用transform属性使长方形倾斜一个角度。

    #parallelogram {

        width: 160px;

        height: 100px;

        background: #8734f7;

        -webkit-transform: skew(30deg);

        -moz-transform: skew(30deg);

        -o-transform: skew(30deg);

        transform: skew(30deg);

    }  

  13. 9

    星形:

    星形的HTML结构同样使用一个带ID的空div。星形的实现方式比较复杂,主要是使用transform属性来旋转不同的边。仔细体会下面的代码。

    #star {

        width: 0;

        height: 0;

        margin: 50px 0;

        color: #fc2e5a;

        position: relative;

        display: block;

        border-right: 100px solid transparent;

        border-bottom: 70px solid #fc2e5a;

        border-left: 100px solid transparent;

        -moz-transform: rotate(35deg);

        -webkit-transform: rotate(35deg);

        -ms-transform: rotate(35deg);

        -o-transform: rotate(35deg);

    }

      

    #star:before {

        height: 0;

        width: 0;

        position: absolute;

        display: block;

        top: -45px;

        left: -65px;

        border-bottom: 80px solid #fc2e5a;

        border-left: 30px solid transparent;

        border-right: 30px solid transparent;

        content: '';

        -webkit-transform: rotate(-35deg);

        -moz-transform: rotate(-35deg);

        -ms-transform: rotate(-35deg);

        -o-transform: rotate(-35deg);

    }

      

    #star:after {

        content: '';

        width: 0;

        height: 0;

        position: absolute;

        display: block;

        top: 3px;

        left: -105px;

        color: #fc2e5a;

        border-right: 100px solid transparent;

        border-bottom: 70px solid #fc2e5a;

        border-left: 100px solid transparent;

        -webkit-transform: rotate(-70deg);

        -moz-transform: rotate(-70deg);

        -ms-transform: rotate(-70deg);

        -o-transform: rotate(-70deg);

    }                              

  14. 10

    六角星形:

    和五角星的制作方法不同,六角星形状的制作方法是操纵border属性来制作两半图形,然后合并它们。

    #star_six_points {

        width: 0;

        height: 0;

        display: block;

        position: absolute;

        border-left: 50px solid transparent;

        border-right: 50px solid transparent;

        border-bottom: 100px solid #de34f7;

        margin: 10px auto;

    }

      

    #star_six_points:after {

        content: "";

        width: 0;

        height: 0;

        position: absolute;

        border-left: 50px solid transparent;

        border-right: 50px solid transparent;

        border-top: 100px solid #de34f7;

        margin: 30px 0 0 -50px;

    }                             

  15. 11

    六边形:

    六边形的制作方法可以有很多种,可以像五边形一样,先制作一个长方形,然后在它的上面和下面各放置一个三角形。

    #hexagon {

        width: 100px;

        height: 55px;

        background: #fc5e5e;

        position: relative;

        margin: 10px auto;

    }

      

    #hexagon:before {

        content: "";

        width: 0;

        height: 0;

        position: absolute;

        top: -25px;

        left: 0;

        border-left: 50px solid transparent;

        border-right: 50px solid transparent;

        border-bottom: 25px solid #fc5e5e;

    }

      

    #hexagon:after {

        content: "";

        width: 0;

        height: 0;

        position: absolute;

        bottom: -25px;

        left: 0;

        border-left: 50px solid transparent;

        border-right: 50px solid transparent;

        border-top: 25px solid #fc5e5e;

    }      

  16. 12

    心形:

    心形的制作是非常复杂的,可以使用伪元素来制作,分别将伪元素旋转不同的角度,并修改transform-origin属性来元素的旋转中心点。

    #heart {

        position: relative;

    }

      

    #heart:before,#heart:after {

        content: "";

        width: 70px;

        height: 115px;

        position: absolute;

        background: red;

        left: 70px;

        top: 0;

        -webkit-border-radius: 50px 50px 0 0;

        -moz-border-radius: 50px 50px 0 0;

        border-radius: 50px 50px 0 0;

        -webkit-transform: rotate(-45deg);

        -moz-transform: rotate(-45deg);

        -ms-transform: rotate(-45deg);

        -o-transform: rotate(-45deg);

        transform: rotate(-45deg);

        -webkit-transform-origin: 0 100%;

        -moz-transform-origin: 0 100%;

        -ms-transform-origin: 0 100%;

        -o-transform-origin: 0 100%;

        transform-origin: 0 100%;

    }

      

    #heart:after {

        left: 0;

        -webkit-transform: rotate(45deg);

        -moz-transform: rotate(45deg);

        -ms-transform: rotate(45deg);

        -o-transform: rotate(45deg);

        transform: rotate(45deg);

        -webkit-transform-origin: 100% 100%;

        -moz-transform-origin: 100% 100%;

        -ms-transform-origin: 100% 100%;

        -o-transform-origin: 100% 100%;

        transform-origin: 100% 100%;

    }          

  17. 13

    蛋形:

    蛋形时椭圆形的一个变体,它的高度要比宽度稍大,并且设置正确的border-radius属性即可以制作出一个蛋形。

    #egg {

        width: 136px;

        height: 190px;

        background: #ffc000;

        display: block;

        -webkit-border-radius: 63px 63px 63px 63px / 108px 108px 72px 72px;

        border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;

    }  

  18. 14

    无穷符号:

    无穷符号可以通过border属性和设置伪元素的角度来实现。

    #infinity {

    width: 220px;

    height: 100px;

    position: relative;

    }

    #infinity:before,#infinity:after {

    content: "";

    width: 60px;

    height: 60px;

    position: absolute;

    top: 0;

    left: 0;

    border: 20px solid #06c999;

    -moz-border-radius: 50px 50px 0;

    border-radius: 50px 50px 0 50px;

    -webkit-transform: rotate(-45deg);

    -moz-transform: rotate(-45deg);

    -ms-transform: rotate(-45deg);

    -o-transform: rotate(-45deg);

    transform: rotate(-45deg);

    }

    #infinity:after {

    left: auto;

    right: 0;

    -moz-border-radius: 50px 50px 50px 0;

    border-radius: 50px 50px 50px 0;

    -webkit-transform: rotate(45deg);

    -moz-transform: rotate(45deg);

    -ms-transform: rotate(45deg);

    -o-transform: rotate(45deg);

    transform: rotate(45deg);

    }

    1. 15
    2. 消息提示框:
    3. 消息提示框可以先制作一个圆角矩形,然后在需要的地方放置一个三角形。
    4. #comment_bubble {
    5.     width: 140px;
    6.     height: 100px;
    7.     background: #088cb7;
    8.     position: relative;
    9.     -moz-border-radius: 12px;
    10.     -webkit-border-radius: 12px;
    11.     border-radius: 12px;
    12. }
    13.   
    14. #comment_bubble:before {
    15.     content: "";
    16.     width: 0;
    17.     height: 0;
    18.     right: 100%;
    19.     top: 38px;
    20.     position: absolute;
    21.     border-top: 13px solid transparent;
    22.     border-right: 26px solid #088cb7;
    23.     border-bottom: 13px solid transparent;
    24. }                              

--------------------------------------------------------------------------------------------------------------------------------------------

****************************************************************************************************

border-bottom:24px solid #F00;
border-right:24px solid transparent;
border-top:24px solid #F00;
border-left:24px solid transparent;

以前以为border是个中规中矩的长方形,我们可以看出来其实border的图片并不是中规中矩的长方形.而是梯形的结构

利用这一原理就可以制作出斜方向的不规则图片如

代码如下:
border-bottom:24px solid #F00;
border-right:24px solid transparent;(宽度存在但是为透明)

 
理解css结构,border设置宽度就意味着自身的高度要设置为0,才能保证他在同一行中。

如图未设置高度为0时

设置height:0时

大家也可以自己尝试一下,

借此也可以更好的理解css3.0中的伪类after,before来构造不规则的图片!避免使用了较大的图片。

*****************************************************************************************************

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
body{ background: #161616;}
.frame{ width: 100%; min-width: 420px;}
.frame li{ float:left; width: 100px; height: 100px; margin: 1px; background: #1c1c1c; list-style: none; padding: 50px;}
.square{ width: 100px; height: 100px; background: #fff;}
.square-round-one{ width: 100px; height: 100px; background: #fff; -webkit-border-top-left-radius: 50%; border-top-left-radius: 50%;}
.square-round-two{ width: 100px; height: 100px; background:#fff; -webkit-border-radius: 50% 0 50% 0;border-radius: 50% 0 50% 0;}
.square-round-three{ width: 100px; height: 100px; background:#fff; -webkit-border-radius: 50% 0 50% 50%;border-radius: 50% 0 50% 50%;}
.square-round-half{ width: 100px; height: 100px; background: #fff; -webkit-border-radius: 0 50% 50% 0;border-radius: 0 50% 50% 0;}
.circle{ width: 100px; height: 100px; background: #fff; -webkit-border-radius: 50%; border-radius:50%;}
.diamond{ width: 100px; height: 100px; background:#fff; -webkit-transform: rotate(45deg); transform: rotate(45deg); -webkit-border-radius: 5%;border-radius: 5%;}
.diamond-cut{border-color:transparent transparent #fff transparent; border-width:0 25px 25px 25px; border-style: solid; position: relative;}
.diamond-cut::after{content: "";border-color:#fff transparent transparent transparent;border-style: solid;border-width:75px 50px 0 50px ;position: absolute; top: 25px; left: -25px;}
.rhombus{ border-color:transparent transparent #fff transparent; border-style: solid; border-width:50px; border-bottom-width:70px; border-top-width: 0; position: relative; top:-30px;}
.rhombus::after{ content: ""; border-color:#fff transparent transparent transparent; border-style: solid; border-width:50px; border-top-width:70px; border-bottom-width:0; position: absolute;top:70px; left:-50px;}
.trapezoid{ width: 100px; margin-left:-35px ; border-bottom: 70px solid #fff; border-left: 35px solid transparent; border-right: 35px solid transparent;}
.pentagon{ width: 70px; position:relative; top:40px; left:0px;border-top: 50px solid #fff; border-left: 18px solid transparent; border-right:18px solid transparent;}
.pentagon::after{ content: ""; border-color: transparent transparent #fff; border-style: solid; border-width: 0 55px 50px; position: absolute; top:-100px; left:-20px;}
.hexagon{ width: 100px; height: 50px; background: #fff; position: relative; margin-top: 25px;}
.hexagon::before{ content: ""; border-color: transparent transparent #fff; border-style: solid; border-width: 0 50px 35px; position: absolute; top:-35px; }
.hexagon::after{ content: ""; border-color: #fff transparent transparent; border-style: solid; border-width:35px 50px 0; position: absolute; top:50px;}
.octagon{ width: 100px; height: 50px; background: #fff; position: relative; margin-top: 25px;}
.octagon::before{content: ""; height:0px; width:50px; position:absolute; margin-top: -25px; border-bottom: 25px solid #fff;border-left:25px solid #1c1c1c; border-right:25px solid #1c1c1c; }
.octagon::after{ content:""; height: 0; width: 50px; position: absolute; margin-top: 50px; border-top: 25px solid #fff; border-left: 25px solid #1c1c1c; border-right: 25px solid #1c1c1c;}
.rectangle{ width: 100px; height: 50px; margin-top: 20px; background:#fff;}
.parallelogram-left{ width: 100px; height: 50px; margin-top: 20px; background:#fff; -webkit-transform: skew(20deg); transform: skew(20deg);}
.parallelogram-right{ width: 100px; height: 50px; margin-top: 20px; background: #fff; -webkit-transform: skew(-20deg); transform: skew(-20deg);}
.heart{ width: 100px; height: 100px; position: relative; margin-left: -10px;}
.heart::before,.heart::after{ content: ""; width: 60px; height: 100px; background:#ff6666; position: absolute; top:0; left:60px; border-radius: 50px 50px 0 0;-webkit-transform: rotate(-45deg); transform: rotate(-45deg); -webkit-transform-origin: 0 100%; transform-origin: 0 100%;}
.heart::after{ position:absolute; left:20px; top:-40px;-webkit-transform: rotate(45deg); transform: rotate(45deg); -webkit-transform-origin: 0 100%; transform-origin: 0 100%; }
.triangle{ width: 0; border-color: transparent transparent #fff; border-style: solid; border-width: 0 50px 100px; }
.triangle-down{ width: 0; border-color: #fff transparent transparent; border-style: solid; border-width: 100px 50px 0;}
.triangle-left{ width: 0; border-color: transparent #fff transparent transparent ; border-style: solid; border-width: 50px 100px 50px 0;}
.triangle-right{ width: 0; border-color: transparent transparent transparent #fff; border-style: solid; border-width: 50px 0 50px 100px;}
.triangle-left-top{ width: 0; border-color: #fff transparent transparent #fff; border-style: solid; border-width: 50px; }
.triangle-right-top{ width: 0; border-color:#fff #fff transparent transparent; border-style: solid; border-width:50px;}
.triangle-left-bottom{ border-color: transparent transparent #fff #fff; border-style: solid; border-width: 50px;}
.triangle-right-bottom{ border-color: transparent #fff #fff transparent; border-style: solid; border-width: 50px;}
.arrow-up{ width: 0; border-color: transparent transparent #fff; border-style: solid; border-width: 0 45px 50px; position: relative; margin-top: -5px; margin-left: 10px;}
.arrow-up::after{ content: ""; width: 35px; height: 70px; background: #fff; position: absolute; top: 30px; left: -18px;}
.arrow-down{ width: 0; border-color: #fff transparent transparent; border-style: solid; border-width: 50px; position: relative; top:50px;}
.arrow-down::after{ content: ""; width: 35px; height: 70px; background: #fff; position: absolute; bottom:25px; left:-18px;}
.arrow-left{ width: 0; border-color: transparent #fff transparent transparent; border-style: solid; border-width: 50px; position: relative;right:60px;}
.arrow-left::after{ content: ""; width: 75px; height:35px; background: #fff; position: absolute; top: -17px; left: 25px;}
.arrow-right{ width: 0; border-color: transparent transparent transparent #fff; border-style: solid; border-width: 50px; position: relative; left: 60px;}
.arrow-right::after{ content: ""; width: 75px; height: 35px; background:#fff; position: absolute; top: -17px; right:25px ;}
.circle-spin-half{ width: 60px; height: 60px; background: transparent; border-color: transparent transparent #fff #fff; border-style: solid; border-width: 20px; border-radius: 50%; -webkit-animation:circle-spin-half 1.2s linear infinite; animation:circle-spin-half 1.2s linear infinite;}
@-webkit-keyframes circle-spin-half{
0%{-webkit-transform: rotate(0deg);}
100%{-webkit-transform: rotate(360deg);}
}
@keyframes circle-spin-half{
0%{transform: rotate(0deg);}
100%{transform: rotate(360deg);}
}
.oval{ width: 100px; height:50px; border-radius: 50%; background:#fff; margin-top: 20px;}
.circle-half-top{ width:100px; height:50px; background:#fff; border-radius: 100px 100px 0 0;}
.circle-half-bottom{ width: 100px; height: 50px; background: #fff; border-radius: 0 0 100px 100px; margin-top: 50px;}
.circle-half-left{ width: 50px; height: 100px; background: #fff; border-radius: 100px 0 0 100px;}
.circle-half-right{ width: 50px; height: 100px; background: #fff; border-radius: 0 100px 100px 0; margin-left: 50px;}
.circle-left-top{ width: 100px; height: 100px; background:#fff; border-top-left-radius:100%;}
.circle-right-top{ width: 100px; height: 100px; background: #fff; border-top-right-radius: 100%;}
.circle-left-bottom{ width: 100px; height: 100px; background: #fff; border-bottom-left-radius: 100%;}
.circle-right-bottom{ width: 100px; height: 100px; background: #fff; border-bottom-right-radius: 100%;}
.circle-quarter-left-top{ border-color: #fff transparent transparent transparent; border-style: solid; border-width: 100px; border-radius: 100%; margin-left:-50px;}
.circle-quarter-right-top{ border-color: transparent #fff transparent transparent; border-style: solid; border-width: 100px; border-radius: 100%; margin-left: -100px; margin-top: -50px;}
.circle-quarter-bottom{ border-color: transparent transparent #fff; border-style: solid; border-width:0 100px 100px; border-radius: 100%; margin-left: -50px;}
.circle-quarter-left{ border-color:transparent transparent transparent #fff; border-style: solid; border-width: 80px 0 80px 100px; border-radius: 100%; margin-top: -35px;}
.circle-wedge-top{border-color: transparent #fff #fff; border-style: solid; border-width: 50px; border-radius: 100%;}
.circle-wedge-right{ border-color: #fff transparent #fff #fff; border-style: solid; border-width: 50px; border-radius: 100%;}
.circle-wedge-bottom{ border-color: #fff #fff transparent #fff; border-style: solid; border-width: 50px; border-radius: 100%;}
.circle-wedge-left{ border-color: #fff #fff #fff transparent; border-style: solid; border-width: 50px; border-radius: 100%;}
.flower{ width: 100px; height: 100px; background: #fff; border-radius:20%;}
.flower::before{ content: ""; width: 100px; height: 100px; background: #fff; border-radius: 20%; position: absolute; -webkit-transform: rotate(45deg); transform: rotate(45deg);}
/*用定位是把添加的元素转化成块级元素,也可以使用display:block;*/
.star-six{ width: 0; border-color: transparent transparent #fff; border-style: solid; border-width:0 50px 80px; position: relative;}
.star-six::after{ content: ""; border-color:#fff transparent transparent; border-style: solid; border-width: 80px 50px 0; position: absolute; left: -50px; top: 25px;}
.star-eight{border-color: #fff transparent #fff transparent; border-style: solid; border-width: 20px; margin-top: 30px; position: relative;}
.star-eight::after{ content: ""; border-color:transparent #fff transparent #fff;border-style: solid; border-width: 20px; position: absolute; height: 60px; top:-50px; left: 10px; }
.star-twelve{ width: 100px; height: 100px; background: #fff; position: relative;}
.star-twelve::before,.star-twelve::after{ content:"";width: 100px; height: 100px; background: #fff; position: absolute; -webkit-transform: rotate(30deg); transform: rotate(30deg);}
.star-twelve::after{ -webkit-transform: rotate(-30deg);transform: rotate(-30deg);}
.cross{ width: 35px; height: 100px; background: #fff; position: relative; margin-left: 30px; -webkit-transform: rotate(45deg); transform: rotate(45deg); }
.cross::after{ content: ""; width: 35px; height: 100px; background: #fff; position: absolute; -webkit-transform: rotate(-90deg); transform: rotate(-90deg);}
.cross-round{background: #ffffff;width: 33px;height: 100px;position: relative;margin-left: 33px;border-radius: 20px;-webkit-transform: rotate(45deg);transform: rotate(45deg);}
.cross-round:before {background: #ffffff;content: "";width: 100px;height: 33px;position: absolute;top: 33px;left: -33px;border-radius: 20px;}
/*两个cross cross-round 两个方式不同,宽高是相反的*/
.plus{ width: 33px; height: 100px; background: #fff; position: relative; left: 33px;}
.plus::after{ content: ""; width: 100px; height: 33px; background: #fff; position: absolute; top: 33px; left: -33px;}
.plus-round{ width: 33px; height: 100px; background: #fff; border-radius: 20px; margin-left: 33px; position: relative;}
.plus-round::after{ content: ""; width: 100px; height: 33px; background: #fff; border-radius: 20px; position: absolute; left: -33px; top:33px;}
.search{ width: 35px; height: 35px; border-radius: 50%;border:8px solid #fff; position:relative; margin-left: 20px; margin-top: 20px;}
.search::after{ width:10px; height:30px; content: ""; background: #fff; position: absolute;top:25px; left: 40px; -webkit-transform: rotate(-45deg); transform: rotate(-45deg);}
.map-pin{ width: 30px; height:30px; border:15px solid #fff; border-radius: 50%; margin-left:20px; margin-top: 10px; position: relative;}
.map-pin::after{ content: "";border-color:#fff transparent transparent; border-style: solid; border-width:35px 25px 0; position: absolute; top:32px; left: -10px;}
.callout{ width: 100px; height:50px;background: #fff; border-radius: 10px; position: relative; margin-top:20px;}
.callout::after{ content: ""; border-color: transparent #fff transparent transparent; border-style: solid; border-width:10px 15px 10px 0; position: absolute; left:-15px; top:15px;}
.yinyang{ width: 96px; height: 48px; border: 2px solid #fff; border-radius: 50%; background: #000; border-width: 2px 2px 50px 2px; position: relative;-webkit-animation: circle-spin-half 1.2s linear infinite; animation: circle-spin-half 1.2s linear infinite;}
.yinyang::before{ content: ""; position: absolute; width: 12px; height: 12px; background: #000; border-radius: 50%; top:50%;left:0; border: 18px solid #fff;}
.yinyang::after{ content: ""; position: absolute; width: 12px; height: 12px; background: #fff; border-radius: 50%;border:18px solid #000; left:50%; top: 50%; }
.iphone{ width:40px; height: 60px; border-width: 15px 5px; border-color:#fff; border-style: solid; border-radius: 5px; position: relative; margin-left: 20px; margin-top:10px;}
.iphone::before{ content: ""; position: absolute; width: 15px; height: 5px; background: #000; top:-10px; left:13px;}
.iphone::after{ content: ""; position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #000; bottom:-13px;left: 14px;}
.bookmark{width: 0; height: 70px; border-left: 25px solid #fff; border-right: 25px solid #fff; border-bottom: 25px solid transparent; margin-left: 25px;}
.battery{ width:50px; height: 30px; background: #fff; position: relative; margin-top: 20px;}
.battery::after{ content: ""; position: absolute; top:-15px; left:-15px; width: 80px; height: 50px; border: 5px solid #fff; border-radius: 5px;}
.battery::before{ content: ""; position: absolute; width: 10px; height: 15px; border: 5px solid #fff; border-radius: 5px; right:-40px; top:5px;}
.eye{ width: 70px; height: 70px; position: relative; background: #fff; border-radius: 50% 0 50% 0; -webkit-transform: rotate(45deg); transform: rotate(45deg);}
.eye::after{ content: ""; position: absolute; width: 20px; height: 20px; background: #fff; border-radius: 50%; border:10px solid #000; top:15px; left: 15px;}
</style>
</head>
<body> <div class="frame">
<ul>
<li><div class="square"></div></li>
<li><div class="square-round-one"></div></li>
<li><div class="square-round-two"></div></li>
<li><div class="square-round-three"></div></li>
<li><div class="square-round-half"></div></li>
<li><div class="circle"></div></li>
<li><div class="diamond"></div></li>
<li><div class="diamond-cut"></div></li>
<li><div class="rhombus"></div></li>
<li><div class="trapezoid"></div></li>
<li><div class="pentagon"></div></li>
<li><div class="hexagon"></div></li>
<li><div class="octagon"></div></li>
<li><div class="rectangle"></div></li>
<li><div class="parallelogram-left"></div></li>
<li><div class="parallelogram-right"></div></li>
<li><div class="heart"></div></li>
<li><div class="triangle"></div></li>
<li><div class="triangle-down"></div></li>
<li><div class="triangle-left"></div></li>
<li><div class="triangle-right"></div></li>
<li><div class="triangle-left-top"></div></li>
<li><div class="triangle-right-top"></div></li>
<li><div class="triangle-left-bottom"></div></li>
<li><div class="triangle-right-bottom"></div></li>
<li><div class="arrow-up"></div></li>
<li><div class="arrow-down"></div></li>
<li><div class="arrow-left"></div></li>
<li><div class="arrow-right"></div></li>
<li><div class="circle-spin-half"></div></li>
<li><div class="oval"></div></li>
<li><div class="circle-half-top"></div></li>
<li><div class="circle-half-bottom"></div></li>
<li><div class="circle-half-left"></div></li>
<li><div class="circle-half-right"></div></li>
<li><div class="circle-left-top"></div></li>
<li><div class="circle-right-top"></div></li>
<li><div class="circle-left-bottom"></div></li>
<li><div class="circle-right-bottom"></div></li>
<li><div class="circle-quarter-left-top"></div></li>
<li><div class="circle-quarter-right-top"></div></li>
<li><div class="circle-quarter-bottom"></div></li>
<li><div class="circle-quarter-left"></div></li>
<li><div class="circle-wedge-top"></div></li>
<li><div class="circle-wedge-right"></div></li>
<li><div class="circle-wedge-bottom"></div></li>
<li><div class="circle-wedge-left"></div></li>
<li><div class="flower"></div></li>
<li><div class="star-six"></div></li>
<li><div class="star-eight"></div></li>
<li><div class="star-twelve"></div></li>
<li><div class="cross"></div></li>
<li><div class="cross-round"></div></li>
<li><div class="plus"></div></li>
<li><div class="plus-round"></div></li>
<li><div class="search"></div></li>
<li><div class="map-pin"></div></li>
<li><div class="callout"></div></li>
<li><div class="yinyang"></div></li>
<li><div class="iphone"></div></li>
<li><div class="bookmark"></div></li>
<li><div class="battery"></div></li>
<li><div class="eye"></div></li>
</ul>
<div style="clear: both;"></div>
</div> </body>
</html>

  

CSS 各种形状的更多相关文章

  1. Css绘制形状

    前言:终于我的大一生活结束了,迎来了愉快的暑假,大家都开始了各自的忙碌.一直忙着一些项目的事情,终于决定今天要更新一篇博客了,对上一阶段的学习做简单的总结. 这次我主要总结一下用Css绘制各种形状的技 ...

  2. CSS图形形状大全

    The Shapes of CSS All of the below use only a single HTML element. Any kind of CSS goes, as long as ...

  3. The Shapes of CSS(css的形状)

    All of the below use only a single HTML element. Any kind of CSS goes, as long as it's supported in ...

  4. css实现三角的一些方法

    css实现三角没有想象中的那么难,只要明白border的各种属性的意思就很好明白css三角是如何实现的. 一下是几个很简单的例子:   css三角形状的制作:     css样式:    .trian ...

  5. css制作的61种图像

    HTML: <!DOCTYPE html> <html> <head> <title>css各种形状</title> <link re ...

  6. 常用CSS代码大全(工作必备)

    用html+css可以很方便的进行网页的排版布局,但不是每一种属性或者代码我们都铭记于心,最近我把CSS中的常用代码进行了归纳总结,方便自己以后查看,同时也分享给大家,希望对你们有用. 一.文本设置 ...

  7. css属性大全(基础篇)

      什么是CSS? CSS全称为Cascading Style Sheets,中文翻译为“层叠样式表”,简称CSS样式表,所以称之为层叠样式表(Cascading Stylesheet)简称CSS.在 ...

  8. HTML 常见代码整合;

    html+css代码 文本设置 1.font-size: 字号参数 2.font-style: 字体格式 3.font-weight: 字体粗细 4.颜色属性 color: 参数 注意使用网页安全色 ...

  9. 了解SVG

    页的节点类型,我们将说明怎样通过Illustrator高速的把SVG文档加入到网页中.我们还会讲讲D3.js,一个强大的.SVG控制的JavaScript库. "SVG并不仅仅用于像素处理. ...

随机推荐

  1. 【POJ3083】Children of the Candy Corn

    本题传送门 本题知识点:深度优先搜索 + 宽度优先搜索 本题题意是求三个路径长度,第一个是一直往左手边走的距离,第二个是一直往右手边走的距离,第三个是最短距离. 第三个很好办,就是一个简单的bfs的模 ...

  2. 2019牛客国庆集训派对day1

    C 存每个值存在的位置,枚举末尾的值,再枚举前面的值,哈希二分出最长相同的,即剩下的为不同的 D \(f_{i,j,k}\)为前i位,最后一个3因子在j,次因子在k G bitset处理有多少位置符合 ...

  3. ICEM-圆角正方体

    原视频下载地址:https://pan.baidu.com/s/1c2cNgJm 密码: rci8

  4. (二)Cisco dhcp snooping配置解释

    #配置dhcp snooping相关命令 Switch(config)#ip dhcp snooping  //打开DHCP Snooping功能Switch(config)#ip dhcp snoo ...

  5. flask 开发接口测试平台

    flask 开发接口测试平台 数据库,forms  views  视图, 数据库如下: # encoding: utf-8 ''' @author: lileilei @file: models.py ...

  6. 测量MySQL的表达式和函数的速度

    测量MySQL的表达式和函数的速度,可以调用benchmark()函数.语法格式是benchmark(loop_count,expr).运行的返回值是0,但是mysql会打印一行显示语句大概要执行多长 ...

  7. 安卓 android studio 报错 The specified Android SDK Build Tools version (27.0.3) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle

    今天将项目迁移到另一台笔记本,进行build出现以下问题,导致build失败 报错截图: 大致意思,目前使用的build工具版本27.0.3不合适.因为当前使用Gradle插件版本是3.2.1,这个版 ...

  8. Swift编码总结6

    1.UILabel的minimumScaleFactor: 需要UIlabel根据字数多少来减小字体大小,使得UIlabel能够显示全所有的文字.你需要做的就是设置minimumScaleFactor ...

  9. python:使用多线程同时执行多个函数

    使用多线程同时执行多个函数 import time import os import threading def open_calc(): with open('test.txt', 'r') as ...

  10. 【Python学习之三】流程控制语句

    环境 虚拟机:VMware 10 Linux版本:CentOS-6.5-x86_64 客户端:Xshell4 FTP:Xftp4 python3.6 一.条件分支if <条件判断1>: & ...