各種純css圖標


CSS3可以實現很多漂亮的圖形,我收集了32種圖形,在下面列出。直接用CSS3畫出這些圖形,要比貼圖性能更好,體驗更加,是一種非常好的網頁美觀方式。

      這32種圖形分別為圓形,橢圓形,三角形,倒三角形,左三角形,右三角形,菱形,梯形,長方形,正方形,圓環,平行四邊形,五角星,六角星,五邊形,六邊形,八邊形,心形,蛋形,無窮符號,消息提示框,鑽石,八卦圖,食豆人,扇形,月牙,頂左直角三角形,頂右直角三角形 ,底左直角三角形 ,底右直角三角形 ,八角形, 十二角形。
      網頁代碼中用到(<!-- 浮動Div換行 --> <div style="clear:both">)和Div邊距設置和浮動(margin: 20px 20px; float: left;

1. 圓形:設置寬度和高度相等,border-radius屬性為寬度或高度的一半。

     效果圖:

                    

1
2
3
4
5
6
7
8
9
#Circle{ 
   width : 100px
   height : 100px
   float left
   background #6fee1d
   -moz-border-radius:  50px
   -webkit-border-radius:  50px
   border-radius:  50px
}

 2.橢圓形:圓形的變體,高度設置為寬度的一半,border-radius屬性為高度除以高度一半。

    效果圖:

                 

1
2
3
4
5
6
7
8
9
#Oval { 
    width 200px
    height 100px
    float left
    background #e9880c
    -webkit-border-radius:  100px  50px
    -moz-border-radius:  100px  50px
    border-radius:  100px  50px
  }

  

3.三角形:寬度和高度設置為0,border設置左,右邊透明,底邊可見Solid。

    效果圖:

                 

復制代碼
復制代碼
#Triangle {  
   width: 0;  
   height: 0;  
   float: left;  
   border-bottom: 100px solid #fcf706;  
   border-left: 50px solid transparent;  
   border-right: 50px solid transparent;  
 } 
復制代碼
復制代碼

  4.倒三角形:寬度和高度設置為0,border設置左,右邊透明,頂邊可見Solid。

    效果圖:

             

1
2
3
4
5
6
7
8
#InvertedTriangle { 
    width 0
    height 0
    float left
    border-top 100px  solid  #30a3bf
    border-left 50px  solid  transparent
    border-right 50px  solid  transparent
  }

  

5.左三角形:寬度和高度設置為0,border設置上,下邊透明,右邊可見Solid。

    效果圖:

              

 

1
2
3
4
5
6
7
8
#LeftTriangle { 
   width 0
   height 0
   float left
   border-top 50px  solid  transparent
   border-right 100px  solid  #466f20
   border-bottom 50px  solid  transparent

6.菱形:使用transform和rotate相結合,使兩個正反三角形上下顯示。

     效果圖:

           

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#Diamond { 
   width 100px
   height 100px
   float left
   background #8e00ff
   /* Rotate */ 
   -webkit-transform: rotate( -45 deg); 
   -moz-transform: rotate( -45 deg); 
   -ms-transform: rotate( -45 deg); 
   -o-transform: rotate( -45 deg); 
   transform: rotate( -45 deg); 
   /* 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 40px  0  10px  240px
  }

  

7.梯形:三角形的變體,設置左右兩條邊相等,並且給它設置一個寬度。

    效果圖:

              

1
2
3
4
5
6
7
8
#Trapezium { 
  height 0
  width 100px
  float left
  border-bottom 100px  solid  #dc2500
  border-left 50px  solid  transparent
  border-right 50px  solid  transparent

8.圓環:在圓形的基礎上設置邊界,邊界顏色與圓形填充顏色不同。

      效果圖:

          

1
2
3
4
5
6
7
8
#Ring { 
  width 100px
  height 100px
  float left
  background-color white
  border-radius:  80px
  border : 5px  #ffd700  solid
}

  

9.平行四邊形:使用transform使長方形傾斜一個角度。

     效果圖:

             

  

  

1
2
3
4
5
6
7
8
9
10
11
#Parallelogram { 
  width 120px
  height 80px
  float left
  margin-left 10px
  -webkit-transform: skew( 30 deg); 
  -moz-transform: skew( 30 deg); 
  -o-transform: skew( 30 deg); 
  transform: skew( 30 deg); 
  background-color #2eda01
}

  

10.五角星:星形的實現方式比較復雜,主要是使用transform屬性來旋轉不同的邊。

      效果圖:

         

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#FiveStar { 
    width 0
    height 0
    float left
    margin 20px  20px
    color #ff0012
    position relative
    display block
    border-right 80px  solid  transparent
    border-bottom 60px  solid  #ff0012
    border-left 80px  solid  transparent
    -moz-transform: rotate( 35 deg); 
    -webkit-transform: rotate( 35 deg); 
    -ms-transform: rotate( 35 deg); 
    -o-transform: rotate( 35 deg); 
 
  #FiveStar:before { 
    height 0
    width 0
    content ''
    position absolute
    display block
    top -35px
    left -50px
    border-bottom 60px  solid  #ff0012
    border-left 20px  solid  transparent
    border-right 20px  solid  transparent
    -webkit-transform: rotate( -35 deg); 
    -moz-transform: rotate( -35 deg); 
    -ms-transform: rotate( -35 deg); 
    -o-transform: rotate( -35 deg); 
 
  #FiveStar:after { 
    width 0
    height 0
    content ''
    position absolute
    display block
    top 3px
    left -85px
    color #ff0012
    border-right 80px  solid  transparent
    border-bottom 60px  solid  #ff0012
    border-left 80px  solid  transparent
    -webkit-transform: rotate( -70 deg); 
    -moz-transform: rotate( -70 deg); 
    -ms-transform: rotate( -70 deg); 
    -o-transform: rotate( -70 deg); 
 

 

11.六角星:使用transform屬性來旋轉不同的邊。

     效果圖:

           

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#SixStar{ 
   width 0
   height 0
   float left
   border-left 50px  solid  transparent
   border-right 50px  solid  transparent
   border-bottom 100px  solid  #cfd810
   position relative
 
  #SixStar:after{ 
   width 0
   height 0
   content ""
   border-top 100px  solid  #cfd810
   border-left 50px  solid  transparent
   border-right 50px  solid  transparent
   position absolute
   top 30px
   left -50px
  }

  

  

12.六邊形:在長方形上面和下面各放置一個三角形。

       效果圖:

                

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#Hexagon { 
    width 100px
    height 55px
    float left
    background #000001
    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  #000001
#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  #000001
}

 

13.五邊形:可以采用三角形和梯形組合。

       效果圖:

               

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#Pentagon{ 
   width 60px
   float left
   position relative
   border-width 52px  20px  0
   border-style solid
   border-color #711ee2  transparent
#Pentagon:before{ 
   content ""
   position absolute
   width 0
   height 0
   top -92px
   left -20px
   border-width 0  50px  40px
   border-style solid
   border-color transparent  transparent  #711ee2

  

 

  14.八邊形:在長方形上面和下面各放置一個梯形。

    效果圖:

           

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#Octagon{ 
   width 100px
   height 100px
   float left
   margin 10px  10px
   background-color #66e006
   position relative
 
  #Octagon:before{ 
   width 42px
   height 0
   top 0
   left 0
   position absolute
   content ""
   border-left 29px  solid  #ffffff
   border-right 29px  solid  #ffffff
   border-bottom 29px  solid  #66e006
 
  #Octagon:after{ 
   width 42px
   height 0
   left 0
   bottom 0
   position absolute
   content ""
   border-left 29px  solid  #ffffff
   border-right 29px  solid  #ffffff
   border-top 29px  solid  #66e006
 

  

 15.心形:心形的制作是非常復雜的,可以使用偽元素來制作,分別將偽元素旋轉不同的角度,並修改transform-origin屬性來設置元素的旋轉中心點。

     效果圖:

        

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#Heart { 
   float left
   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( -45 deg); 
   -moz-transform: rotate( -45 deg); 
   -ms-transform: rotate( -45 deg); 
   -o-transform: rotate( -45 deg); 
   transform: rotate( -45 deg); 
   -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( 45 deg); 
   -moz-transform: rotate( 45 deg); 
   -ms-transform: rotate( 45 deg); 
   -o-transform: rotate( 45 deg); 
   transform: rotate( 45 deg); 
   -webkit-transform-origin:  100%  100%
   -moz-transform-origin:  100%  100%
   -ms-transform-origin:  100%  100%
   -o-transform-origin:  100%  100%
   transform-origin:  100%  100%
 

  16.蛋形:橢圓形的變體,高度比寬度稍大,設置正確的border-radius屬性。

     效果圖:

          

1
2
3
4
5
6
7
8
9
#Egg { 
   width 100px
   height 160px
   float left
   background #ffb028
   display block
   -webkit-border-radius:  60px  60px  60px  60px  100px  100px  68px  68px
   border-radius:  50%  50%  50%  50%  60%  60%  40%  40%
 

  

17.無窮符號:通過border屬性和設置偽元素的角度來實現。

     效果圖:

             

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#Infinity { 
   width 220px
   height 100px
   float left
   position relative
 
  #Infinity:before, #Infinity:after { 
   content ""
   width 60px
   height 60px
   position absolute
   top 0
   left 0
   border 20px  solid  #008bb0
   -moz-border-radius:  50px  50px  0
   border-radius:  50px  50px  0  50px
   -webkit-transform: rotate( -45 deg); 
   -moz-transform: rotate( -45 deg); 
   -ms-transform: rotate( -45 deg); 
   -o-transform: rotate( -45 deg); 
   transform: rotate( -45 deg); 
 
  #Infinity:after { 
   left auto
   right 0
   -moz-border-radius:  50px  50px  50px  0
   border-radius:  50px  50px  50px  0
   -webkit-transform: rotate( 45 deg); 
   -moz-transform: rotate( 45 deg); 
   -ms-transform: rotate( 45 deg); 
   -o-transform: rotate( 45 deg); 
   transform: rotate( 45 deg); 
 

  18.消息提示框:一個圓角矩形加左邊中間的一個小三角形。

 

     效果圖:

           

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#CommentBubble { 
    width 140px
    height 100px
    margin 30px  20px
    float left
    background #8867b9
    position relative
    -moz-border-radius:  12px
    -webkit-border-radius:  12px
    border-radius:  12px
 
  #CommentBubble:before { 
    content ""
    width 0
    height 0
    right 100%
    top 38px
    position absolute
    border-top 13px  solid  transparent
    border-right 26px  solid  #8867b9
    border-bottom 13px  solid  transparent
 

  19.鑽石:上面一個梯形,下面一個三角形組成。

      效果圖:

             

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#Diamonds{ 
   width 50px
   height 0
   float left
   border-style solid
   border-color transparent  transparent  #9aff02  transparent
   border-width 0  25px  25px  25px
   position relative
   margin 20px  0  50px  0
#Diamonds:after{ 
   width 0
   height 0
   top 25px
   left -25px
   border-style solid
   border-color #9aff02  transparent  transparent  transparent
   border-width 70px  50px  0  50px
   position absolute
   content ""
 

   20.八卦圖:多個圓形的組合。

       效果圖:

          

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#EightDiagrams{ 
   width 96px
   height 48px
   margin 20px  20px
   float left
   background-color #ffffff
   border-color #000000
   border-style solid
   border-width 2px  2px  50px  2px
   border-radius:  100%
   position relative
 
  #EightDiagrams:before { 
   width 12px
   height 12px
   top 50%
   left 0
   content ""
   position absolute
   background-color #ffffff
   border 18px  solid  #000000
   border-radius:  100%
 
  #EightDiagrams:after { 
   width 12px
   height 12px
   top 50%
   left 50%
   background-color #000000
   border 18px  solid  #ffffff
   border-radius: 100%
   content ""
   position absolute
 

     21.食豆人:設置border和border-top-left-radius,border-bottom-right-radius等屬性。

       效果圖:

        

1
2
3
4
5
6
7
8
9
10
11
12
13
#PacMan { 
  width 0
  height 0
  float left
  border-right 60px  solid  transparent
  border-left 60px  solid  #300fed
  border-top 60px  solid  #300fed
  border-bottom 60px  solid  #300fed
  border-top-left-radius:  60px
  border-top-right-radius:  60px
  border-bottom-left-radius:  60px
  border-bottom-right-radius:  60px

   22.扇形:在三角形的基礎上,讓其中一邊成弧形 。

       效果圖:

          

1
2
3
4
5
6
7
8
9
10
#Sector { 
    width : 0
    height : 0
    float left
    background-color #ffffff
    border-left 70px  solid  transparent
    border-right 70px  solid  transparent
    border-top 100px  solid  #ab9ed1
    border-radius: 50%
 

  23.月牙:由兩條弧線組成的,每個弧線可以看成一個圓的一部分弧長,在圓的基礎上讓圓有一個陰影可以形成一個月牙。

        效果圖:

            

1
2
3
4
5
6
7
8
#CrescentMoon{ 
    width : 80px
    height : 80px
    float left
    background-color #ffffff
    border-radius: 50%
    box-shadow:  15px  15px  0  0  #9600d2
 

  24.頂左直角三角形。

       效果圖:

          

1
2
3
4
5
6
7
8
#TopLeftTriangle { 
    width 0px
    height 0px
    margin 10px  10px
    float left
    border-top 100px  solid  #7efde1
    border-right 100px  solid  transparent
  }

  25.八角形。

        效果圖:

                  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#Burst 8 
  width 80px
  height 80px
  margin 10px  10px
  float left
  background-color #cf7668
  position relative
  transform:rotate( 20 deg); 
  -webkit-transform:rotate( 20 deg); 
  -ms-transform:rotate( 20 deg); 
  -moz-transform:rotate( 20 deg); 
  -o-transform:rotate( 20 deg); 
#Burst 8: before{ 
  width 80px
  height 80px
  top 0
  left 0
  background-color #cf7668
  position absolute
  content ""
  transform:rotate( 135 deg); 
  -webkit-transform:rotate( 135 deg); 
  -ms-transform:rotate( 135 deg); 
  -moz-transform:rotate( 135 deg); 
  -o-transform:rotate( 135 deg); 

 26.十二角形。

          效果圖:

             

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#Burst 12 
    width 80px
    height 80px
    margin 20px  20px
    float left
    background-color #a8ff26
    position relative
    text-align center
 
  #Burst 12: before, #Burst 12: after{ 
    width 80px
    height 80px
    top 0
    left 0
    background-color #a8ff26
    position absolute
    content ""
 
  #Burst 12: before{ 
    transform:rotate( 30 deg); 
    -webkit-transform:rotate( 30 deg); 
    -ms-transform:rotate( 30 deg); 
    -moz-transform:rotate( 30 deg); 
    -o-transform:rotate( 30 deg); 
 
  #Burst 12: after{ 
    transform:rotate( 60 deg); 
    -webkit-transform:rotate( 60 deg); 
    -ms-transform:rotate( 60 deg); 
    -moz-transform:rotate( 60 deg); 
    -o-transform:rotate( 60 deg); 
 

  完整的CSS3+HTML5代碼:

CSS3可以實現很多漂亮的圖形,我收集了32種圖形,在下面列出。直接用CSS3畫出這些圖形,要比貼圖性能更好,體驗更加,是一種非常好的網頁美觀方式。

      這32種圖形分別為圓形,橢圓形,三角形,倒三角形,左三角形,右三角形,菱形,梯形,長方形,正方形,圓環,平行四邊形,五角星,六角星,五邊形,六邊形,八邊形,心形,蛋形,無窮符號,消息提示框,鑽石,八卦圖,食豆人,扇形,月牙,頂左直角三角形,頂右直角三角形 ,底左直角三角形 ,底右直角三角形 ,八角形, 十二角形。
      網頁代碼中用到(<!-- 浮動Div換行 --> <div style="clear:both">)和Div邊距設置和浮動(margin: 20px 20px; float: left;

1. 圓形:設置寬度和高度相等,border-radius屬性為寬度或高度的一半。

     效果圖:

                    

1
2
3
4
5
6
7
8
9
#Circle{ 
   width : 100px
   height : 100px
   float left
   background #6fee1d
   -moz-border-radius:  50px
   -webkit-border-radius:  50px
   border-radius:  50px
}

 2.橢圓形:圓形的變體,高度設置為寬度的一半,border-radius屬性為高度除以高度一半。

    效果圖:

                 

1
2
3
4
5
6
7
8
9
#Oval { 
    width 200px
    height 100px
    float left
    background #e9880c
    -webkit-border-radius:  100px  50px
    -moz-border-radius:  100px  50px
    border-radius:  100px  50px
  }

  

3.三角形:寬度和高度設置為0,border設置左,右邊透明,底邊可見Solid。

    效果圖:

                 

復制代碼
復制代碼
#Triangle {  
   width: 0;  
   height: 0;  
   float: left;  
   border-bottom: 100px solid #fcf706;  
   border-left: 50px solid transparent;  
   border-right: 50px solid transparent;  
 } 
復制代碼
復制代碼

  4.倒三角形:寬度和高度設置為0,border設置左,右邊透明,頂邊可見Solid。

    效果圖:

             

1
2
3
4
5
6
7
8
#InvertedTriangle { 
    width 0
    height 0
    float left
    border-top 100px  solid  #30a3bf
    border-left 50px  solid  transparent
    border-right 50px  solid  transparent
  }

  

5.左三角形:寬度和高度設置為0,border設置上,下邊透明,右邊可見Solid。

    效果圖:

              

 

1
2
3
4
5
6
7
8
#LeftTriangle { 
   width 0
   height 0
   float left
   border-top 50px  solid  transparent
   border-right 100px  solid  #466f20
   border-bottom 50px  solid  transparent

6.菱形:使用transform和rotate相結合,使兩個正反三角形上下顯示。

     效果圖:

           

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#Diamond { 
   width 100px
   height 100px
   float left
   background #8e00ff
   /* Rotate */ 
   -webkit-transform: rotate( -45 deg); 
   -moz-transform: rotate( -45 deg); 
   -ms-transform: rotate( -45 deg); 
   -o-transform: rotate( -45 deg); 
   transform: rotate( -45 deg); 
   /* 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 40px  0  10px  240px
  }

  

7.梯形:三角形的變體,設置左右兩條邊相等,並且給它設置一個寬度。

    效果圖:

              

1
2
3
4
5
6
7
8
#Trapezium { 
  height 0
  width 100px
  float left
  border-bottom 100px  solid  #dc2500
  border-left 50px  solid  transparent
  border-right 50px  solid  transparent

8.圓環:在圓形的基礎上設置邊界,邊界顏色與圓形填充顏色不同。

      效果圖:

          

1
2
3
4
5
6
7
8
#Ring { 
  width 100px
  height 100px
  float left
  background-color white
  border-radius:  80px
  border : 5px  #ffd700  solid
}

  

9.平行四邊形:使用transform使長方形傾斜一個角度。

     效果圖:

             

  

  

1
2
3
4
5
6
7
8
9
10
11
#Parallelogram { 
  width 120px
  height 80px
  float left
  margin-left 10px
  -webkit-transform: skew( 30 deg); 
  -moz-transform: skew( 30 deg); 
  -o-transform: skew( 30 deg); 
  transform: skew( 30 deg); 
  background-color #2eda01
}

  

10.五角星:星形的實現方式比較復雜,主要是使用transform屬性來旋轉不同的邊。

      效果圖:

         

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#FiveStar { 
    width 0
    height 0
    float left
    margin 20px  20px
    color #ff0012
    position relative
    display block
    border-right 80px  solid  transparent
    border-bottom 60px  solid  #ff0012
    border-left 80px  solid  transparent
    -moz-transform: rotate( 35 deg); 
    -webkit-transform: rotate( 35 deg); 
    -ms-transform: rotate( 35 deg); 
    -o-transform: rotate( 35 deg); 
 
  #FiveStar:before { 
    height 0
    width 0
    content ''
    position absolute
    display block
    top -35px
    left -50px
    border-bottom 60px  solid  #ff0012
    border-left 20px  solid  transparent
    border-right 20px  solid  transparent
    -webkit-transform: rotate( -35 deg); 
    -moz-transform: rotate( -35 deg); 
    -ms-transform: rotate( -35 deg); 
    -o-transform: rotate( -35 deg); 
 
  #FiveStar:after { 
    width 0
    height 0
    content ''
    position absolute
    display block
    top 3px
    left -85px
    color #ff0012
    border-right 80px  solid  transparent
    border-bottom 60px  solid  #ff0012
    border-left 80px  solid  transparent
    -webkit-transform: rotate( -70 deg); 
    -moz-transform: rotate( -70 deg); 
    -ms-transform: rotate( -70 deg); 
    -o-transform: rotate( -70 deg); 
 

 

11.六角星:使用transform屬性來旋轉不同的邊。

     效果圖:

           

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#SixStar{ 
   width 0
   height 0
   float left
   border-left 50px  solid  transparent
   border-right 50px  solid  transparent
   border-bottom 100px  solid  #cfd810
   position relative
 
  #SixStar:after{ 
   width 0
   height 0
   content ""
   border-top 100px  solid  #cfd810
   border-left 50px  solid  transparent
   border-right 50px  solid  transparent
   position absolute
   top 30px
   left -50px
  }

  

  

12.六邊形:在長方形上面和下面各放置一個三角形。

       效果圖:

                

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#Hexagon { 
    width 100px
    height 55px
    float left
    background #000001
    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  #000001
#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  #000001
}

 

13.五邊形:可以采用三角形和梯形組合。

       效果圖:

               

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#Pentagon{ 
   width 60px
   float left
   position relative
   border-width 52px  20px  0
   border-style solid
   border-color #711ee2  transparent
#Pentagon:before{ 
   content ""
   position absolute
   width 0
   height 0
   top -92px
   left -20px
   border-width 0  50px  40px
   border-style solid
   border-color transparent  transparent  #711ee2

  

 

  14.八邊形:在長方形上面和下面各放置一個梯形。

    效果圖:

           

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#Octagon{ 
   width 100px
   height 100px
   float left
   margin 10px  10px
   background-color #66e006
   position relative
 
  #Octagon:before{ 
   width 42px
   height 0
   top 0
   left 0
   position absolute
   content ""
   border-left 29px  solid  #ffffff
   border-right 29px  solid  #ffffff
   border-bottom 29px  solid  #66e006
 
  #Octagon:after{ 
   width 42px
   height 0
   left 0
   bottom 0
   position absolute
   content ""
   border-left 29px  solid  #ffffff
   border-right 29px  solid  #ffffff
   border-top 29px  solid  #66e006
 

  

 15.心形:心形的制作是非常復雜的,可以使用偽元素來制作,分別將偽元素旋轉不同的角度,並修改transform-origin屬性來設置元素的旋轉中心點。

     效果圖:

        

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#Heart { 
   float left
   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( -45 deg); 
   -moz-transform: rotate( -45 deg); 
   -ms-transform: rotate( -45 deg); 
   -o-transform: rotate( -45 deg); 
   transform: rotate( -45 deg); 
   -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( 45 deg); 
   -moz-transform: rotate( 45 deg); 
   -ms-transform: rotate( 45 deg); 
   -o-transform: rotate( 45 deg); 
   transform: rotate( 45 deg); 
   -webkit-transform-origin:  100%  100%
   -moz-transform-origin:  100%  100%
   -ms-transform-origin:  100%  100%
   -o-transform-origin:  100%  100%
   transform-origin:  100%  100%
 

  16.蛋形:橢圓形的變體,高度比寬度稍大,設置正確的border-radius屬性。

     效果圖:

          

1
2
3
4
5
6
7
8
9
#Egg { 
   width 100px
   height 160px
   float left
   background #ffb028
   display block
   -webkit-border-radius:  60px  60px  60px  60px  100px  100px  68px  68px
   border-radius:  50%  50%  50%  50%  60%  60%  40%  40%
 

  

17.無窮符號:通過border屬性和設置偽元素的角度來實現。

     效果圖:

             

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#Infinity { 
   width 220px
   height 100px
   float left
   position relative
 
  #Infinity:before, #Infinity:after { 
   content ""
   width 60px
   height 60px
   position absolute
   top 0
   left 0
   border 20px  solid  #008bb0
   -moz-border-radius:  50px  50px  0
   border-radius:  50px  50px  0  50px
   -webkit-transform: rotate( -45 deg); 
   -moz-transform: rotate( -45 deg); 
   -ms-transform: rotate( -45 deg); 
   -o-transform: rotate( -45 deg); 
   transform: rotate( -45 deg); 
 
  #Infinity:after { 
   left auto
   right 0
   -moz-border-radius:  50px  50px  50px  0
   border-radius:  50px  50px  50px  0
   -webkit-transform: rotate( 45 deg); 
   -moz-transform: rotate( 45 deg); 
   -ms-transform: rotate( 45 deg); 
   -o-transform: rotate( 45 deg); 
   transform: rotate( 45 deg); 
 

  18.消息提示框:一個圓角矩形加左邊中間的一個小三角形。

 

     效果圖:

           

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#CommentBubble { 
    width 140px
    height 100px
    margin 30px  20px
    float left
    background #8867b9
    position relative
    -moz-border-radius:  12px
    -webkit-border-radius:  12px
    border-radius:  12px
 
  #CommentBubble:before { 
    content ""
    width 0
    height 0
    right 100%
    top 38px
    position absolute
    border-top 13px  solid  transparent
    border-right 26px  solid  #8867b9
    border-bottom 13px  solid  transparent
 

  19.鑽石:上面一個梯形,下面一個三角形組成。

      效果圖:

             

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#Diamonds{ 
   width 50px
   height 0
   float left
   border-style solid
   border-color transparent  transparent  #9aff02  transparent
   border-width 0  25px  25px  25px
   position relative
   margin 20px  0  50px  0
#Diamonds:after{ 
   width 0
   height 0
   top 25px
   left -25px
   border-style solid
   border-color #9aff02  transparent  transparent  transparent
   border-width 70px  50px  0  50px
   position absolute
   content ""
 

   20.八卦圖:多個圓形的組合。

       效果圖:

          

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#EightDiagrams{ 
   width 96px
   height 48px
   margin 20px  20px
   float left
   background-color #ffffff
   border-color #000000
   border-style solid
   border-width 2px  2px  50px  2px
   border-radius:  100%
   position relative
 
  #EightDiagrams:before { 
   width 12px
   height 12px
   top 50%
   left 0
   content ""
   position absolute
   background-color #ffffff
   border 18px  solid  #000000
   border-radius:  100%
 
  #EightDiagrams:after { 
   width 12px
   height 12px
   top 50%
   left 50%
   background-color #000000
   border 18px  solid  #ffffff
   border-radius: 100%
   content ""
   position absolute
 

     21.食豆人:設置border和border-top-left-radius,border-bottom-right-radius等屬性。

       效果圖:

        

1
2
3
4
5
6
7
8
9
10
11
12
13
#PacMan { 
  width 0
  height 0
  float left
  border-right 60px  solid  transparent
  border-left 60px  solid  #300fed
  border-top 60px  solid  #300fed
  border-bottom 60px  solid  #300fed
  border-top-left-radius:  60px
  border-top-right-radius:  60px
  border-bottom-left-radius:  60px
  border-bottom-right-radius:  60px

   22.扇形:在三角形的基礎上,讓其中一邊成弧形 。

       效果圖:

          

1
2
3
4
5
6
7
8
9
10
#Sector { 
    width : 0
    height : 0
    float left
    background-color #ffffff
    border-left 70px  solid  transparent
    border-right 70px  solid  transparent
    border-top 100px  solid  #ab9ed1
    border-radius: 50%
 

  23.月牙:由兩條弧線組成的,每個弧線可以看成一個圓的一部分弧長,在圓的基礎上讓圓有一個陰影可以形成一個月牙。

        效果圖:

            

1
2
3
4
5
6
7
8
#CrescentMoon{ 
    width : 80px
    height : 80px
    float left
    background-color #ffffff
    border-radius: 50%
    box-shadow:  15px  15px  0  0  #9600d2
 

  24.頂左直角三角形。

       效果圖:

          

1
2
3
4
5
6
7
8
#TopLeftTriangle { 
    width 0px
    height 0px
    margin 10px  10px
    float left
    border-top 100px  solid  #7efde1
    border-right 100px  solid  transparent
  }

  25.八角形。

        效果圖:

                  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#Burst 8 
  width 80px
  height 80px
  margin 10px  10px
  float left
  background-color #cf7668
  position relative
  transform:rotate( 20 deg); 
  -webkit-transform:rotate( 20 deg); 
  -ms-transform:rotate( 20 deg); 
  -moz-transform:rotate( 20 deg); 
  -o-transform:rotate( 20 deg); 
#Burst 8: before{ 
  width 80px
  height 80px
  top 0
  left 0
  background-color #cf7668
  position absolute
  content ""
  transform:rotate( 135 deg); 
  -webkit-transform:rotate( 135 deg); 
  -ms-transform:rotate( 135 deg); 
  -moz-transform:rotate( 135 deg); 
  -o-transform:rotate( 135 deg); 

 26.十二角形。

          效果圖:

             

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#Burst 12 
    width 80px
    height 80px
    margin 20px  20px
    float left
    background-color #a8ff26
    position relative
    text-align center
 
  #Burst 12: before, #Burst 12: after{ 
    width 80px
    height 80px
    top 0
    left 0
    background-color #a8ff26
    position absolute
    content ""
 
  #Burst 12: before{ 
    transform:rotate( 30 deg); 
    -webkit-transform:rotate( 30 deg); 
    -ms-transform:rotate( 30 deg); 
    -moz-transform:rotate( 30 deg); 
    -o-transform:rotate( 30 deg); 
 
  #Burst 12: after{ 
    transform:rotate( 60 deg); 
    -webkit-transform:rotate( 60 deg); 
    -ms-transform:rotate( 60 deg); 
    -moz-transform:rotate( 60 deg); 
    -o-transform:rotate( 60 deg); 
 

  完整的CSS3+HTML5代碼:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
<!DOCTYPE html> 
<html> 
<head> 
   <meta charset= "UTF-8"
   <title>CSS 3 實現基本圖形</title> 
   <style> 
    #Circle{ 
      width : 100px
      height : 100px
      float left
      background #6fee1d
      -moz-border-radius:  50px
      -webkit-border-radius:  50px
      border-radius:  50px
   
    #Oval { 
      width 200px
      height 100px
      float left
      background #e9880c
      -webkit-border-radius:  100px  50px
      -moz-border-radius:  100px  50px
      border-radius:  100px  50px
   
    #Triangle { 
      width 0
      height 0
      float left
      border-bottom 100px  solid  #fcf706
      border-left 50px  solid  transparent
      border-right 50px  solid  transparent
   
    #InvertedTriangle { 
      width 0
      height 0
      float left
      border-top 100px  solid  #30a3bf
      border-left 50px  solid  transparent
      border-right 50px  solid  transparent
   
    #LeftTriangle { 
      width 0
      height 0
      float left
      border-top 50px  solid  transparent
      border-right 100px  solid  #466f20
      border-bottom 50px  solid  transparent
   
    #RightTriangle { 
      width 0
      height 0
      float left
      border-top 50px  solid  transparent
      border-left 100px  solid  #800820
      border-bottom 50px  solid  transparent
   
    #Diamond { 
     width 100px
     height 100px
     float left
     background #8e00ff
     /* Rotate */ 
     -webkit-transform: rotate( -45 deg); 
     -moz-transform: rotate( -45 deg); 
     -ms-transform: rotate( -45 deg); 
     -o-transform: rotate( -45 deg); 
     transform: rotate( -45 deg); 
     /* 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 40px  0  10px  240px
   
    #Trapezium { 
     height 0
     width 100px
     float left
     border-bottom 100px  solid  #dc2500
     border-left 50px  solid  transparent
     border-right 50px  solid  transparent
   
    #Rectangle { 
     height 50px
     width 100px
     float left
     background #afe05d
   
    #Square { 
     height 100px
     width 100px
     float left
     background #b02089
   
    #Ring { 
     width 100px
     height 100px
     float left
     background-color white
     border-radius:  80px
     border : 5px  #ffd700  solid
   
    #Parallelogram { 
     width 120px
     height 80px
     float left
     margin-left 10px
     -webkit-transform: skew( 30 deg); 
     -moz-transform: skew( 230 deg); 
     -o-transform: skew( 30 deg); 
     transform: skew( 30 deg); 
     background-color #2eda01
   
   
    #FiveStar { 
      width 0
      height 0
      float left
      margin 20px  20px
      color #ff0012
      position relative
      display block
      border-right 80px  solid  transparent
      border-bottom 60px  solid  #ff0012
      border-left 80px  solid  transparent
      -moz-transform: rotate( 35 deg); 
      -webkit-transform: rotate( 35 deg); 
      -ms-transform: rotate( 35 deg); 
      -o-transform: rotate( 35 deg); 
   
    #FiveStar:before { 
      height 0
      width 0
      content ''
      position absolute
      display block
      top -35px
      left -50px
      border-bottom 60px  solid  #ff0012
      border-left 20px  solid  transparent
      border-right 20px  solid  transparent
      -webkit-transform: rotate( -35 deg); 
      -moz-transform: rotate( -35 deg); 
      -ms-transform: rotate( -35 deg); 
      -o-transform: rotate( -35 deg); 
   
    #FiveStar:after { 
      width 0
      height 0
      content ''
      position absolute
      display block
      top 3px
      left -85px
      color #ff0012
      border-right 80px  solid  transparent
      border-bottom 60px  solid  #ff0012
      border-left 80px  solid  transparent
      -webkit-transform: rotate( -70 deg); 
      -moz-transform: rotate( -70 deg); 
      -ms-transform: rotate( -70 deg); 
      -o-transform: rotate( -70 deg); 
   
   
    #SixStar{ 
      width 0
      height 0
      float left
      border-left 50px  solid  transparent
      border-right 50px  solid  transparent
      border-bottom 100px  solid  #cfd810
      position relative
    
     #SixStar:after{ 
      width 0
      height 0
      content ""
      border-top 100px  solid  #cfd810
      border-left 50px  solid  transparent
      border-right 50px  solid  transparent
      position absolute
      top 30px
      left -50px
    
   
     #Pentagon{ 
       width 60px
       float left
       position relative
       border-width 52px  20px  0
       border-style solid
       border-color #711ee2  transparent
    
     #Pentagon:before{ 
       content ""
       position absolute
       width 0
       height 0
       top -92px
       left -20px
       border-width 0  50px  40px
       border-style solid
       border-color transparent  transparent  #711ee2
    
   
     #Hexagon { 
       width 100px
       height 55px
       float left
       background #000001
       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  #000001
   
    #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  #000001
   
   
    #Octagon{ 
     width 100px
     height 100px
     float left
     margin 10px  10px
     background-color #66e006
     position relative
   
    #Octagon:before{ 
     width 42px
     height 0
     top 0
     left 0
     position absolute
     content ""
     border-left 29px  solid  #ffffff
     border-right 29px  solid  #ffffff
     border-bottom 29px  solid  #66e006
   
    #Octagon:after{ 
     width 42px
     height 0
     left 0
     bottom 0
     position absolute
     content ""
     border-left 29px  solid  #ffffff
     border-right 29px  solid  #ffffff
     border-top 29px  solid  #66e006
   
   
    #Heart { 
     float left
     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( -45 deg); 
     -moz-transform: rotate( -45 deg); 
     -ms-transform: rotate( -45 deg); 
     -o-transform: rotate( -45 deg); 
     transform: rotate( -45 deg); 
     -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( 45 deg); 
     -moz-transform: rotate( 45 deg); 
     -ms-transform: rotate( 45 deg); 
     -o-transform: rotate( 45 deg); 
     transform: rotate( 45 deg); 
     -webkit-transform-origin:  100%  100%
     -moz-transform-origin:  100%  100%
     -ms-transform-origin:  100%  100%
     -o-transform-origin:  100%  100%
     transform-origin:  100%  100%
   
   
    #Egg { 
     width 100px
     height 160px
     float left
     background #ffb028
     display block
     -webkit-border-radius:  60px  60px  60px  60px  100px  100px  68px  68px
     border-radius:  50%  50%  50%  50%  60%  60%  40%  40%
   
   
    #Infinity { 
     width 220px
     height 100px
     float left
     position relative
   
    #Infinity:before, #Infinity:after { 
     content ""
     width 60px
     height 60px
     position absolute
     top 0
     left 0
     border 20px  solid  #008bb0
     -moz-border-radius:  50px  50px  0
     border-radius:  50px  50px  0  50px
     -webkit-transform: rotate( -45 deg); 
     -moz-transform: rotate( -45 deg); 
     -ms-transform: rotate( -45 deg); 
     -o-transform: rotate( -45 deg); 
     transform: rotate( -45 deg); 
   
    #Infinity:after { 
     left auto
     right 0
     -moz-border-radius:  50px  50px  50px  0
     border-radius:  50px  50px  50px  0
     -webkit-transform: rotate( 45 deg); 
     -moz-transform: rotate( 45 deg); 
     -ms-transform: rotate( 45 deg); 
     -o-transform: rotate( 45 deg); 
     transform: rotate( 45 deg); 
   
   
    #CommentBubble { 
      width 140px
      height 100px
      margin 30px  20px
      float left
      background #8867b9
      position relative
      -moz-border-radius:  12px
      -webkit-border-radius:  12px
      border-radius:  12px
   
    #CommentBubble:before { 
      content ""
      width 0
      height 0
      right 100%
      top 38px
      position absolute
      border-top 13px  solid  transparent
      border-right 26px  solid  #8867b9
      border-bottom 13px  solid  transparent
   
   
    #Diamonds{ 
      width 50px
      height 0
      float left
      border-style solid
      border-color transparent  transparent  #9aff02  transparent
      border-width 0  25px  25px  25px
      position relative
      margin 20px  0  50px  0
   
    #Diamonds:after{ 
      width 0
      height 0
      top 25px
      left -25px
      border-style solid
      border-color #9aff02  transparent  transparent  transparent
      border-width 70px  50px  0  50px
      position absolute
      content ""
    
   
     #EightDiagrams{ 
      width 96px
      height 48px
      margin 20px  20px
      float left
      background-color #ffffff
      border-color #000000
      border-style solid
      border-width 2px  2px  50px  2px
      border-radius:  100%
      position relative
    
     #EightDiagrams:before { 
      width 12px
      height 12px
      top 50%
      left 0
      content ""
      position absolute
      background-color #ffffff
      border 18px  solid  #000000
      border-radius:  100%
    
     #EightDiagrams:after { 
      width 12px
      height 12px
      top 50%
      left 50%
      background-color #000000
      border 18px  solid  #ffffff
      border-radius: 100%
      content ""
      position absolute
    
   
     #PacMan { 
      width 0
      height 0
      float left
      border-right 60px  solid  transparent
      border-left 60px  solid  #300fed
      border-top 60px  solid  #300fed
      border-bottom 60px  solid  #300fed
      border-top-left-radius:  60px
      border-top-right-radius:  60px
      border-bottom-left-radius:  60px
      border-bottom-right-radius:  60px
    
   
     #Sector { 
       width : 0
       height : 0
       float left
       background-color #ffffff
       border-left 70px  solid  transparent
       border-right 70px  solid  transparent
       border-top 100px  solid  #ab9ed1
       border-radius: 50%
    
   
     #CrescentMoon{ 
       width : 80px
       height : 80px
       float left
       background-color #ffffff
       border-radius: 50%
       box-shadow:  15px  15px  0  0  #9600d2
    
   
     #TopLeftTriangle { 
       width 0px
       height 0px
       margin 10px  10px
       float left
       border-top 100px  solid  #7efde1
       border-right 100px  solid  transparent
    
     #TopRightTriangle { 
       width 0px
       height 0px
       margin 10px  10px
       float left
       border-top 100px  solid  #400526
       border-left 100px  solid  transparent
    
     #BottomLeftTriangle { 
      width 0px
      height 0px
      margin 10px  10px
      float left
      border-bottom 100px  solid  #600ffe
      border-right 100px  solid  transparent
    
     #BottomRightTriangle { 
      width 0px
      height 0px
      margin 10px  10px
      float left
      border-bottom 100px  solid  #ff7578
      border-left 100px  solid  transparent
    
   
     #Burst 8 
      width 80px
      height 80px
      margin 10px  10px
      float left
      background-color #cf7668
      position relative
      transform:rotate( 20 deg); 
      -webkit-transform:rotate( 20 deg); 
      -ms-transform:rotate( 20 deg); 
      -moz-transform:rotate( 20 deg); 
      -o-transform:rotate( 20 deg); 
    
     #Burst 8: before{ 
      width 80px
      height 80px
      top 0
      left 0
      background-color #cf7668
      position absolute
      content ""
      transform:rotate( 135 deg); 
      -webkit-transform:rotate( 135 deg); 
      -ms-transform:rotate( 135 deg); 
      -moz-transform:rotate( 135 deg); 
      -o-transform:rotate( 135 deg); 
    
   
     #Burst 12 
       width 80px
       height 80px
       margin 20px  20px
       float left
       background-color #a8ff26
       position relative
       text-align center
    
     #Burst 12: before, #Burst 12: after{ 
       width 80px
       height 80px
       top 0
       left 0
       background-color #a8ff26
       position absolute
       content ""
    
     #Burst 12: before{ 
       transform:rotate( 30 deg); 
       -webkit-transform:rotate( 30 deg); 
       -ms-transform:rotate( 30 deg); 
       -moz-transform:rotate( 30 deg); 
       -o-transform:rotate( 30 deg); 
    
     #Burst 12: after{ 
       transform:rotate( 60 deg); 
       -webkit-transform:rotate( 60 deg); 
       -ms-transform:rotate( 60 deg); 
       -moz-transform:rotate( 60 deg); 
       -o-transform:rotate( 60 deg); 
    
   </style> 
</head> 
<body> 
   <!-- 圓形:設置寬度和高度相等,border-radius屬性為寬度或高度的一半 --> 
   <div id= "Circle" ></div> 
   <!-- 橢圓形:圓形的變體,高度設置為寬度的一半,border-radius屬性為高度除以高度一半 --> 
   <div id= "Oval" ></div> 
   <!-- 三角形:寬度和高度設置為 0 ,border設置左,右邊透明,底邊可見Solid --> 
   <div id= "Triangle" ></div> 
   <!-- 倒三角形:寬度和高度設置為 0 ,border設置左,右邊透明,頂邊可見Solid --> 
   <div id= "InvertedTriangle" ></div> 
   <!-- 左三角形:寬度和高度設置為 0 ,border設置上,下邊透明,右邊可見Solid --> 
   <div id= "LeftTriangle" ></div> 
   <!-- 右三角形:寬度和高度設置為 0 ,border設置上,下邊透明,左邊可見Solid --> 
   <div id= "RightTriangle" ></div> 
   <!-- 菱形:使用transform和rotate相結合,使兩個正反三角形上下顯示 --> 
   <div id= "Diamond" ></div> 
   <!-- 梯形:三角形的變體,設置左右兩條邊相等,並且給它設置一個寬度 --> 
   <div id= "Trapezium" ></div> 
   <!-- 長方形:寬比高長 --> 
   <div id= "Rectangle" ></div> 
   
   <!-- 浮動Div換行 --> 
   <div style= "clear:both"
   <!-- 正方形:寬和高相等 --> 
   <div id= "Square" ></div> 
   <!-- 圓環:在圓形的基礎上設置邊界,邊界顏色與圓形填充顏色不同 --> 
   <div id= "Ring" ></div> 
   <!-- 平行四邊形:使用transform使長方形傾斜一個角度 --> 
   <div id= "Parallelogram" ></div> 
   <!-- 五角星:星形的實現方式比較復雜,主要是使用transform屬性來旋轉不同的邊 --> 
   <div id= "FiveStar" ></div> 
   <!-- 六角星:使用transform屬性來旋轉不同的邊 --> 
   <div id= "SixStar" ></div> 
   <!-- 五邊形:可以采用三角形和梯形組合 --> 
   <div id= "Pentagon" ></div> 
   <!-- 六邊形:在長方形上面和下面各放置一個三角形 --> 
   <div id= "Hexagon" ></div> 
   <!-- 八邊形:在長方形上面和下面各放置一個梯形 --> 
   <div id= "Octagon" ></div> 
   <!-- 心形:心形的制作是非常復雜的,可以使用偽元素來制作,分別將偽元素旋轉不同的角度,並修改transform-origin屬性來設置元素的旋轉中心點 --> 
   <div id= "Heart" ></div> 
   
   <!-- 浮動Div換行 --> 
   <div style= "clear:both"
   <!-- 蛋形:橢圓形的變體,高度比寬度稍大,設置正確的border-radius屬性 --> 
   <div id= "Egg" ></div> 
   <!-- 無窮符號:通過border屬性和設置偽元素的角度來實現 --> 
   <div id= "Infinity" ></div> 
   <!-- 消息提示框:一個圓角矩形加左邊中間的一個小三角形 --> 
   <div id= "CommentBubble" ></div> 
   <!-- 鑽石:上面一個梯形,下面一個三角形組成 --> 
   <div id= "Diamonds" ></div> 
   <!-- 八卦圖:多個圓形的組合--> 
   <div id= "EightDiagrams" ></div> 
   <!-- 食豆人:設置border和border-top-left-radius,border-bottom-right-radius等屬性--> 
   <div id= "PacMan" ></div> 
   <!-- 扇形:在三角形的基礎上,讓其中一邊成弧形 --> 
   <div id= "Sector" ></div> 
   <!-- 月牙:由兩條弧線組成的,每個弧線可以看成一個圓的一部分弧長,在圓的基礎上讓圓有一個陰影可以形成一個月牙 --> 
   <div id= "CrescentMoon" ></div> 
   
   <!-- 浮動Div換行 --> 
   <div style= "clear:both"
   <!-- 頂左直角三角形 --> fdxfdsdds    <div id= "TopLeftTriangle" ></div> 
   <!-- 頂右直角三角形 --> 
   <div id= "TopRightTriangle" ></div> 
   <!-- 底左直角三角形 --> 
   <div id= "BottomLeftTriangle" ></div> 
   <!-- 底右直角三角形 --> 
   <div id= "BottomRightTriangle" ></div> 
   <!-- 八角形 --> 
   <div id= "Burst8" ></div> 
   <!-- 十二角形 --> 
   <div id= "Burst12" ></div> 
</body> 
</html> 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
<!DOCTYPE html> 
<html> 
<head> 
   <meta charset= "UTF-8"
   <title>CSS 3 實現基本圖形</title> 
   <style> 
    #Circle{ 
      width : 100px
      height : 100px
      float left
      background #6fee1d
      -moz-border-radius:  50px
      -webkit-border-radius:  50px
      border-radius:  50px
   
    #Oval { 
      width 200px
      height 100px
      float left
      background #e9880c
      -webkit-border-radius:  100px  50px
      -moz-border-radius:  100px  50px
      border-radius:  100px  50px
   
    #Triangle { 
      width 0
      height 0
      float left
      border-bottom 100px  solid  #fcf706
      border-left 50px  solid  transparent
      border-right 50px  solid  transparent
   
    #InvertedTriangle { 
      width 0
      height 0
      float left
      border-top 100px  solid  #30a3bf
      border-left 50px  solid  transparent
      border-right 50px  solid  transparent
   
    #LeftTriangle { 
      width 0
      height 0
      float left
      border-top 50px  solid  transparent
      border-right 100px  solid  #466f20
      border-bottom 50px  solid  transparent
   
    #RightTriangle { 
      width 0
      height 0
      float left
      border-top 50px  solid  transparent
      border-left 100px  solid  #800820
      border-bottom 50px  solid  transparent
   
    #Diamond { 
     width 100px
     height 100px
     float left
     background #8e00ff
     /* Rotate */ 
     -webkit-transform: rotate( -45 deg); 
     -moz-transform: rotate( -45 deg); 
     -ms-transform: rotate( -45 deg); 
     -o-transform: rotate( -45 deg); 
     transform: rotate( -45 deg); 
     /* 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 40px  0  10px  240px
   
    #Trapezium { 
     height 0
     width 100px
     float left
     border-bottom 100px  solid  #dc2500
     border-left 50px  solid  transparent
     border-right 50px  solid  transparent
   
    #Rectangle { 
     height 50px
     width 100px
     float left
     background #afe05d
   
    #Square { 
     height 100px
     width 100px
     float left
     background #b02089
   
    #Ring { 
     width 100px
     height 100px
     float left
     background-color white
     border-radius:  80px
     border : 5px  #ffd700  solid
   
    #Parallelogram { 
     width 120px
     height 80px
     float left
     margin-left 10px
     -webkit-transform: skew( 30 deg); 
     -moz-transform: skew( 230 deg); 
     -o-transform: skew( 30 deg); 
     transform: skew( 30 deg); 
     background-color #2eda01
   
   
    #FiveStar { 
      width 0
      height 0
      float left
      margin 20px  20px
      color #ff0012
      position relative
      display block
      border-right 80px  solid  transparent
      border-bottom 60px  solid  #ff0012
      border-left 80px  solid  transparent
      -moz-transform: rotate( 35 deg); 
      -webkit-transform: rotate( 35 deg); 
      -ms-transform: rotate( 35 deg); 
      -o-transform: rotate( 35 deg); 
   
    #FiveStar:before { 
      height 0
      width 0
      content ''
      position absolute
      display block
      top -35px
      left -50px
      border-bottom 60px  solid  #ff0012
      border-left 20px  solid  transparent
      border-right 20px  solid  transparent
      -webkit-transform: rotate( -35 deg); 
      -moz-transform: rotate( -35 deg); 
      -ms-transform: rotate( -35 deg); 
      -o-transform: rotate( -35 deg); 
   
    #FiveStar:after { 
      width 0
      height 0
      content ''
      position absolute
      display block
      top 3px
      left -85px
      color #ff0012
      border-right 80px  solid  transparent
      border-bottom 60px  solid  #ff0012
      border-left 80px  solid  transparent
      -webkit-transform: rotate( -70 deg); 
      -moz-transform: rotate( -70 deg); 
      -ms-transform: rotate( -70 deg); 
      -o-transform: rotate( -70 deg); 
   
   
    #SixStar{ 
      width 0
      height 0
      float left
      border-left 50px  solid  transparent
      border-right 50px  solid  transparent
      border-bottom 100px  solid  #cfd810
      position relative
    
     #SixStar:after{ 
      width 0
      height 0
      content ""
      border-top 100px  solid  #cfd810
      border-left 50px  solid  transparent
      border-right 50px  solid  transparent
      position absolute
      top 30px
      left -50px
    
   
     #Pentagon{ 
       width 60px
       float left
       position relative
       border-width 52px  20px  0
       border-style solid
       border-color #711ee2  transparent
    
     #Pentagon:before{ 
       content ""
       position absolute
       width 0
       height 0
       top -92px
       left -20px
       border-width 0  50px  40px
       border-style solid
       border-color transparent  transparent  #711ee2
    
   
     #Hexagon { 
       width 100px
       height 55px
       float left
       background #000001
       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  #000001
   
    #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  #000001
   
   
    #Octagon{ 
     width 100px
     height 100px
     float left
     margin 10px  10px
     background-color #66e006
     position relative
   
    #Octagon:before{ 
     width 42px
     height 0
     top 0
     left 0
     position absolute
     content ""
     border-left 29px  solid  #ffffff
     border-right 29px  solid  #ffffff
     border-bottom 29px  solid  #66e006
   
    #Octagon:after{ 
     width 42px
     height 0
     left 0
     bottom 0
     position absolute
     content ""
     border-left 29px  solid  #ffffff
     border-right 29px  solid  #ffffff
     border-top 29px  solid  #66e006
   
   
    #Heart { 
     float left
     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( -45 deg); 
     -moz-transform: rotate( -45 deg); 
     -ms-transform: rotate( -45 deg); 
     -o-transform: rotate( -45 deg); 
     transform: rotate( -45 deg); 
     -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( 45 deg); 
     -moz-transform: rotate( 45 deg); 
     -ms-transform: rotate( 45 deg); 
     -o-transform: rotate( 45 deg); 
     transform: rotate( 45 deg); 
     -webkit-transform-origin:  100%  100%
     -moz-transform-origin:  100%  100%
     -ms-transform-origin:  100%  100%
     -o-transform-origin:  100%  100%
     transform-origin:  100%  100%
   
   
    #Egg { 
     width 100px
     height 160px
     float left
     background #ffb028
     display block
     -webkit-border-radius:  60px  60px  60px  60px  100px  100px  68px  68px
     border-radius:  50%  50%  50%  50%  60%  60%  40%  40%
   
   
    #Infinity { 
     width 220px
     height 100px
     float left
     position relative
   
    #Infinity:before, #Infinity:after { 
     content ""
     width 60px
     height 60px
     position absolute
     top 0
     left 0
     border 20px  solid  #008bb0
     -moz-border-radius:  50px  50px  0
     border-radius:  50px  50px  0  50px
     -webkit-transform: rotate( -45 deg); 
     -moz-transform: rotate( -45 deg); 
     -ms-transform: rotate( -45 deg); 
     -o-transform: rotate( -45 deg); 
     transform: rotate( -45 deg); 
   
    #Infinity:after { 
     left auto
     right 0
     -moz-border-radius:  50px  50px  50px  0
     border-radius:  50px  50px  50px  0
     -webkit-transform: rotate( 45 deg); 
     -moz-transform: rotate( 45 deg); 
     -ms-transform: rotate( 45 deg); 
     -o-transform: rotate( 45 deg); 
     transform: rotate( 45 deg); 
   
   
    #CommentBubble { 
      width 140px
      height 100px
      margin 30px  20px
      float left
      background #8867b9
      position relative
      -moz-border-radius:  12px
      -webkit-border-radius:  12px
      border-radius:  12px
   
    #CommentBubble:before { 
      content ""
      width 0
      height 0
      right 100%
      top 38px
      position absolute
      border-top 13px  solid  transparent
      border-right 26px  solid  #8867b9
      border-bottom 13px  solid  transparent
   
   
    #Diamonds{ 
      width 50px
      height 0
      float left
      border-style solid
      border-color transparent  transparent  #9aff02  transparent
      border-width 0  25px  25px  25px
      position relative
      margin 20px  0  50px  0
   
    #Diamonds:after{ 
      width 0
      height 0
      top 25px
      left -25px
      border-style solid
      border-color #9aff02  transparent  transparent  transparent
      border-width 70px  50px  0  50px
      position absolute
      content ""
    
   
     #EightDiagrams{ 
      width 96px
      height 48px
      margin 20px  20px
      float left
      background-color #ffffff
      border-color #000000
      border-style solid
      border-width 2px  2px  50px  2px
      border-radius:  100%
      position relative
    
     #EightDiagrams:before { 
      width 12px
      height 12px
      top 50%
      left 0
      content ""
      position absolute
      background-color #ffffff
      border 18px  solid  #000000
      border-radius:  100%
    
     #EightDiagrams:after { 
      width 12px
      height 12px
      top 50%
      left 50%
      background-color #000000
      border 18px  solid  #ffffff
      border-radius: 100%
      content ""
      position absolute
    
   
     #PacMan { 
      width 0
      height 0
      float left
      border-right 60px  solid  transparent
      border-left 60px  solid  #300fed
      border-top 60px  solid  #300fed
      border-bottom 60px  solid  #300fed
      border-top-left-radius:  60px
      border-top-right-radius:  60px
      border-bottom-left-radius:  60px
      border-bottom-right-radius:  60px
    
   
     #Sector { 
       width : 0
       height : 0
       float left
       background-color #ffffff
       border-left 70px  solid  transparent
       border-right 70px  solid  transparent
       border-top 100px  solid  #ab9ed1
       border-radius: 50%
    
   
     #CrescentMoon{ 
       width : 80px
       height : 80px
       float left
       background-color #ffffff
       border-radius: 50%
       box-shadow:  15px  15px  0  0  #9600d2
    
   
     #TopLeftTriangle { 
       width 0px
       height 0px
       margin 10px  10px
       float left
       border-top 100px  solid  #7efde1
       border-right 100px  solid  transparent
    
     #TopRightTriangle { 
       width 0px
       height 0px
       margin 10px  10px
       float left
       border-top 100px  solid  #400526
       border-left 100px  solid  transparent
    
     #BottomLeftTriangle { 
      width 0px
      height 0px
      margin 10px  10px
      float left
      border-bottom 100px  solid  #600ffe
      border-right 100px  solid  transparent
    
     #BottomRightTriangle { 
      width 0px
      height 0px
      margin 10px  10px
      float left
      border-bottom 100px  solid  #ff7578
      border-left 100px  solid  transparent
    
   
     #Burst 8 
      width 80px
      height 80px
      margin 10px  10px
      float left
      background-color #cf7668
      position relative
      transform:rotate( 20 deg); 
      -webkit-transform:rotate( 20 deg); 
      -ms-transform:rotate( 20 deg); 
      -moz-transform:rotate( 20 deg); 
      -o-transform:rotate( 20 deg); 
    
     #Burst 8: before{ 
      width 80px
      height 80px
      top 0
      left 0
      background-color #cf7668
      position absolute
      content ""
      transform:rotate( 135 deg); 
      -webkit-transform:rotate( 135 deg); 
      -ms-transform:rotate( 135 deg); 
      -moz-transform:rotate( 135 deg); 
      -o-transform:rotate( 135 deg); 
    
   
     #Burst 12 
       width 80px
       height 80px
       margin 20px  20px
       float left
       background-color #a8ff26
       position relative
       text-align center
    
     #Burst 12: before, #Burst 12: after{ 
       width 80px
       height 80px
       top 0
       left 0
       background-color #a8ff26
       position absolute
       content ""
    
     #Burst 12: before{ 
       transform:rotate( 30 deg); 
       -webkit-transform:rotate( 30 deg); 
       -ms-transform:rotate( 30 deg); 
       -moz-transform:rotate( 30 deg); 
       -o-transform:rotate( 30 deg); 
    
     #Burst 12: after{ 
       transform:rotate( 60 deg); 
       -webkit-transform:rotate( 60 deg); 
       -ms-transform:rotate( 60 deg); 
       -moz-transform:rotate( 60 deg); 
       -o-transform:rotate( 60 deg); 
    
   </style> 
</head> 
<body> 
   <!-- 圓形:設置寬度和高度相等,border-radius屬性為寬度或高度的一半 --> 
   <div id= "Circle" ></div> 
   <!-- 橢圓形:圓形的變體,高度設置為寬度的一半,border-radius屬性為高度除以高度一半 --> 
   <div id= "Oval" ></div> 
   <!-- 三角形:寬度和高度設置為 0 ,border設置左,右邊透明,底邊可見Solid --> 
   <div id= "Triangle" ></div> 
   <!-- 倒三角形:寬度和高度設置為 0 ,border設置左,右邊透明,頂邊可見Solid --> 
   <div id= "InvertedTriangle" ></div> 
   <!-- 左三角形:寬度和高度設置為 0 ,border設置上,下邊透明,右邊可見Solid --> 
   <div id= "LeftTriangle" ></div> 
   <!-- 右三角形:寬度和高度設置為 0 ,border設置上,下邊透明,左邊可見Solid --> 
   <div id= "RightTriangle" ></div> 
   <!-- 菱形:使用transform和rotate相結合,使兩個正反三角形上下顯示 --> 
   <div id= "Diamond" ></div> 
   <!-- 梯形:三角形的變體,設置左右兩條邊相等,並且給它設置一個寬度 --> 
   <div id= "Trapezium" ></div> 
   <!-- 長方形:寬比高長 --> 
   <div id= "Rectangle" ></div> 
   
   <!-- 浮動Div換行 --> 
   <div style= "clear:both"
   <!-- 正方形:寬和高相等 --> 
   <div id= "Square" ></div> 
   <!-- 圓環:在圓形的基礎上設置邊界,邊界顏色與圓形填充顏色不同 --> 
   <div id= "Ring" ></div> 
   <!-- 平行四邊形:使用transform使長方形傾斜一個角度 --> 
   <div id= "Parallelogram" ></div> 
   <!-- 五角星:星形的實現方式比較復雜,主要是使用transform屬性來旋轉不同的邊 --> 
   <div id= "FiveStar" ></div> 
   <!-- 六角星:使用transform屬性來旋轉不同的邊 --> 
   <div id= "SixStar" ></div> 
   <!-- 五邊形:可以采用三角形和梯形組合 --> 
   <div id= "Pentagon" ></div> 
   <!-- 六邊形:在長方形上面和下面各放置一個三角形 --> 
   <div id= "Hexagon" ></div> 
   <!-- 八邊形:在長方形上面和下面各放置一個梯形 --> 
   <div id= "Octagon" ></div> 
   <!-- 心形:心形的制作是非常復雜的,可以使用偽元素來制作,分別將偽元素旋轉不同的角度,並修改transform-origin屬性來設置元素的旋轉中心點 --> 
   <div id= "Heart" ></div> 
   
   <!-- 浮動Div換行 --> 
   <div style= "clear:both"
   <!-- 蛋形:橢圓形的變體,高度比寬度稍大,設置正確的border-radius屬性 --> 
   <div id= "Egg" ></div> 
   <!-- 無窮符號:通過border屬性和設置偽元素的角度來實現 --> 
   <div id= "Infinity" ></div> 
   <!-- 消息提示框:一個圓角矩形加左邊中間的一個小三角形 --> 
   <div id= "CommentBubble" ></div> 
   <!-- 鑽石:上面一個梯形,下面一個三角形組成 --> 
   <div id= "Diamonds" ></div> 
   <!-- 八卦圖:多個圓形的組合--> 
   <div id= "EightDiagrams" ></div> 
   <!-- 食豆人:設置border和border-top-left-radius,border-bottom-right-radius等屬性--> 
   <div id= "PacMan" ></div> 
   <!-- 扇形:在三角形的基礎上,讓其中一邊成弧形 --> 
   <div id= "Sector" ></div> 
   <!-- 月牙:由兩條弧線組成的,每個弧線可以看成一個圓的一部分弧長,在圓的基礎上讓圓有一個陰影可以形成一個月牙 --> 
   <div id= "CrescentMoon" ></div> 
   
   <!-- 浮動Div換行 --> 
   <div style= "clear:both"
   <!-- 頂左直角三角形 --> 
   <div id= "TopLeftTriangle" ></div> 
   <!-- 頂右直角三角形 --> 
   <div id= "TopRightTriangle" ></div> 
   <!-- 底左直角三角形 --> 
   <div id= "BottomLeftTriangle" ></div> 
   <!-- 底右直角三角形 --> 
   <div id= "BottomRightTriangle" ></div> 
   <!-- 八角形 --> 
   <div id= "Burst8" ></div> 
   <!-- 十二角形 --> 
   <div id= "Burst12" ></div> 
</body> 
</html> 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM