Ada beberapa macam bangun datar yang tersedia disini. Beikut kode CSSnya

Square

How to draw shapes with CSS3
#square {
 width: 100px;
 height: 100px;
 background: #333;
}

Rectangle

How to draw shapes with CSS3
#rectangle {
 width: 200px;
 height: 100px;
 background: #333;
}

Circle

How to draw shapes with CSS3
#circle {
 width: 100px;
 height: 100px;
 background: #333;
 -moz-border-radius: 50px;
 -webkit-border-radius: 50px;
 border-radius: 50px;
}

Ellipse

How to draw shapes with CSS3
#ellipse {
 width: 200px;
 height: 100px;
 background: #333;
 -moz-border-radius: 100px / 50px;
 -webkit-border-radius: 100px / 50px;
 border-radius: 100px / 50px;
}

Triangle

How to draw shapes with CSS3
#triangle {
 width: 0;
 height: 0;
 border-left: 50px solid transparent;
 border-right: 50px solid transparent;
 border-bottom: 100px solid #333;
}

Arrow bullet

How to draw shapes with CSS3
#arrow_bullet {
 width: 0;
 height: 0;
 border-top: 50px solid transparent;
 border-left: 100px solid #333;
 border-bottom: 50px solid transparent;
}

Trapezoid

How to draw shapes with CSS3
#trapezoid {
    border-bottom: 100px solid #333;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    height: 0;
    width: 100px;
}

Star

How to draw shapes with CSS3
#star {
   margin: 50px 0;
   position: relative;
   display: block;
   color: #333;
   width: 0px;
   height: 0px;
   border-right:  100px solid transparent;
   border-bottom: 70px  solid #333;
   border-left:   100px solid transparent;
   -moz-transform:    rotate(35deg);
   -webkit-transform: rotate(35deg);
   -ms-transform:     rotate(35deg);
   -o-transform:      rotate(35deg);
}
#star:before {
   border-bottom: 80px solid #333;
   border-left: 30px solid transparent;
   border-right: 30px solid transparent;
   position: absolute;
   height: 0;
   width: 0;
   top: -45px;
   left: -65px;
   display: block;
   content: '';
   -webkit-transform: rotate(-35deg);
   -moz-transform:    rotate(-35deg);
   -ms-transform:     rotate(-35deg);
   -o-transform:      rotate(-35deg);
 
}
#star:after {
   position: absolute;
   display: block;
   color: #333;
   top: 3px;
   left: -105px;
   width: 0px;
   height: 0px;
   border-right: 100px solid transparent;
   border-bottom: 70px solid #333;
   border-left: 100px solid transparent;
   -webkit-transform: rotate(-70deg);
   -moz-transform:    rotate(-70deg);
   -ms-transform:     rotate(-70deg);
   -o-transform:      rotate(-70deg);
   content: '';
}

Pentagon

How to draw shapes with CSS3
#pentagon {
    position: relative;
    width: 54px;
    border-width: 50px 18px 0;
    border-style: solid;
    border-color: #333 transparent;
}
#pentagon:before {
    content: "";
    position: absolute;
    height: 0;
    width: 0;
    top: -85px;
    left: -18px;
    border-width: 0 45px 35px;
    border-style: solid;
    border-color: transparent transparent #333;
}

Heart

How to draw shapes with CSS3
#heart {
    position: relative;
    width: 100px;
    height: 90px;
}
#heart:before,
#heart:after {
    position: absolute;
    content: "";
    left: 50px;
    top: 0;
    width: 50px;
    height: 80px;
    background: #333;
    -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%;
}

Infinity

How to draw shapes with CSS3
#infinity {
    position: relative;
    width: 212px;
    height: 100px;
}

#infinity:before,
#infinity:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 60px;  
    border: 20px solid #333;
    -moz-border-radius: 50px 50px 0 50px;
         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);
}

Egg

How to draw shapes with CSS3
#egg {
   display:block;
   width: 126px;
   height: 180px;
   background-color: #333;
   -webkit-border-radius: 63px 63px 63px 63px / 108px 108px 72px 72px;
   border-radius:        50%   50%  50%  50%  / 60%   60%   40%  40%;
}

Pac-Man

How to draw shapes with CSS3
#pacman {
  width: 0px;
  height: 0px;
  border-right: 60px solid transparent;
  border-top: 60px solid #333;
  border-left: 60px solid #333;
  border-bottom: 60px solid #333;
  border-top-left-radius: 60px;
  border-top-right-radius: 60px;
  border-bottom-left-radius: 60px;
  border-bottom-right-radius: 60px;
}

Talk Bubble

How to draw shapes with CSS3
#talkbubble {
   width: 120px;
   height: 80px;
   background: #333;
   position: relative;
   -moz-border-radius:    10px;
   -webkit-border-radius: 10px;
   border-radius:         10px;
}
#talkbubble:before {
   content:"";
   position: absolute;
   right: 100%;
   top: 26px;
   width: 0;
   height: 0;
   border-top: 13px solid transparent;
   border-right: 26px solid #333;
   border-bottom: 13px solid transparent;
}

Diamond

How to draw shapes with CSS3
#diamond {
    border-style: solid;
    border-color: transparent transparent #333 transparent;
    border-width: 0 25px 25px 25px;
    height: 0;
    width: 50px;
    position: relative;
    margin: 20px 0 50px 0;
}
#diamond:after {
    content: "";
    position: absolute;
    top: 25px;
    left: -25px;
    width: 0;
    height: 0;
    border-style: solid;
    border-color: red transparent transparent transparent;
    border-width: 70px 50px 0 50px;
}

Biohazard

How to draw shapes with CSS3
#biohazard {
  width: 0;
  height: 0;
  border-bottom: 60px solid #333;
  border-top: 60px solid #333;
  border-left: 60px solid #fff;
  border-right: 60px solid #fff;
  -moz-border-radius: 60px;
  -webkit-border-radius: 60px;
  border-radius: 60px;
}


Terima kasih sudah mampir dan belajar disini. 



Referensi: http://www.dreamincoloronline.com/how-to-draw-shapes-with-css3/

6 comments

12 Januari 2012 06.00

wow lengkap banget gan, thanks ya :)

12 Januari 2012 21.50

Hm.............
pengembangan css3

14 Januari 2012 02.51

keren nih,tapi setiap shape dalam css itu beda-beda.
pernah saya cari yang seperti itu.

22 Februari 2012 14.43

@Cirebon-Cyber4rtiya

22 Februari 2012 14.43

@MR.c0r3iyaa

22 Februari 2012 14.43

@Trisna N:)

Posting Komentar

Konversi Kode
[Mulai Senin, 30 Januari 2012] Maaf, Jangan Masukkan Link Pada Komentar