CSS3绘制的基本图形

1、正方形

CSS3绘制的基本图形_第1张图片

#square {
  width: 100px;
  height: 100px;
  background: #6bbf20;
}

2、长方形

CSS3绘制的基本图形_第2张图片

#square {
  width: 200px;
  height: 100px;
  background: #6bbf20;
}

3、圆形

CSS3绘制的基本图形_第3张图片

#square {
  width: 100px;
  height: 100px;
  background: #6bbf20;
  border-radius: 50%
}

4、椭圆

CSS3绘制的基本图形_第4张图片

#square {
  width: 200px;
  height: 100px;
  background: #6bbf20;
  border-radius: 100px / 50px;
}

5、上三角

CSS3绘制的基本图形_第5张图片

#square {
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-bottom: 100px solid #6bbf20;
}

6、下三角

CSS3绘制的基本图形_第6张图片

#square {
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-top: 100px solid #6bbf20;
}

7、左三角

CSS3绘制的基本图形_第7张图片

#square {
  width: 0;
  height: 0;
  border-top: 50px solid transparent;
  border-right: 100px solid #6bbf20;
  border-bottom: 50px solid transparent;
}

8、右三角

CSS3绘制的基本图形_第8张图片

#square {
  width: 0;
  height: 0;
  border-top: 50px solid transparent;
  border-left: 100px solid #6bbf20;
  border-bottom: 50px solid transparent;
}

9、左上三角

CSS3绘制的基本图形_第9张图片

#square {
  width: 0;
  height: 0;
  border-top: 100px solid #6bbf20;
  border-right: 100px solid transparent;
}

10、右上三角

CSS3绘制的基本图形_第10张图片

#square {
  width: 0;
  height: 0;
  border-top: 100px solid #6bbf20;
  border-left: 100px solid transparent;
}

11、左下三角

CSS3绘制的基本图形_第11张图片

#square {
  width: 0;
  height: 0;
  border-bottom: 100px solid #6bbf20;
  border-right: 100px solid transparent;
}

12、右下三角

CSS3绘制的基本图形_第12张图片

#square {
  width: 0;
  height: 0;
  border-bottom: 100px solid #6bbf20;
  border-left: 100px solid transparent;
}

13、平行四边形

CSS3绘制的基本图形_第13张图片

#square {
  width: 150px;
  height: 100px;
  transform: skew(20deg);
  background: #6bbf20;
}

14、梯形

CSS3绘制的基本图形_第14张图片

#square {
  border-bottom: 100px solid #6bbf20;
  border-left: 25px solid transparent;
  border-right: 25px solid transparent;
  height: 0;
  width: 100px;
}

15、弯曲的尾箭

  #square {
    position: relative;
    width: 0;
    height: 0;
    border-top: 9px solid transparent;
    border-right: 9px solid #6bbf20;
    transform: rotate(10deg);
  }
  #square:after {
    content: "";
    position: absolute;
    border: 0 solid transparent;
    border-top: 3px solid #6bbf20;
    border-radius: 20px 0 0 0;
    top: -12px;
    left: -9px;
    width: 12px;
    height: 12px;
    transform: rotate(45deg);
  }

16、六角星

CSS3绘制的基本图形_第15张图片

  #square {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 100px solid #6bbf20;
    position: relative;
  }
  #square:after {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-top: 100px solid #6bbf20;
    position: absolute;
    content: "";
    top: 30px;
    left: -50px;
  }

17、五角星

CSS3绘制的基本图形_第16张图片

  #square {
    margin: 50px 0;
    position: relative;
    display: block;
    color: red;
    width: 0px;
    height: 0px;
    border-right: 100px solid transparent;
    border-bottom: 70px solid #6bbf20;
    border-left: 100px solid transparent;
    transform: rotate(35deg);
  }
  #square:before {
    border-bottom: 80px solid #6bbf20;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    position: absolute;
    height: 0;
    width: 0;
    top: -45px;
    left: -65px;
    display: block;
    content: '';
    transform: rotate(-35deg);
  }
  #square:after {
    position: absolute;
    display: block;
    color: red;
    top: 3px;
    left: -105px;
    width: 0px;
    height: 0px;
    border-right: 100px solid transparent;
    border-bottom: 70px solid #6bbf20;
    border-left: 100px solid transparent;
    transform: rotate(-70deg);
    content: '';
  }

18、五角大楼

  #square {
    position: relative;
    width: 54px;
    margin-top:50px;
    box-sizing: content-box;
    border-width: 50px 18px 0;
    border-style: solid;
    border-color: #6bbf20 transparent;
  }
  #square:before {
    content: "";
    position: absolute;
    height: 0;
    width: 0;
    top: -85px;
    left: -18px;
    border-width: 0 45px 35px;
    border-style: solid;
    border-color: transparent transparent #6bbf20;
  }

19、六边形

CSS3绘制的基本图形_第17张图片

  #square {
    width: 100px;
    height: 55px;
    margin-top: 40px;
    background: #6bbf20;
    position: relative;
  }
  #square:before {
    content: "";
    position: absolute;
    top: -25px;
    left: 0;
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 25px solid #6bbf20;
  }
  #square:after {
    content: "";
    position: absolute;
    bottom: -25px;
    left: 0;
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-top: 25px solid #6bbf20;
  }

20、八角形

CSS3绘制的基本图形_第18张图片

  #square {
    width: 100px;
    height: 100px;
    background: #6bbf20;
    position: relative;
  }
  #square:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    border-bottom: 29px solid #6bbf20;
    border-left: 29px solid #eee;
    border-right: 29px solid #eee;
    width: 42px;
    height: 0;
  }
  #square:after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    border-top: 29px solid #6bbf20;
    border-left: 29px solid #eee;
    border-right: 29px solid #eee;
    width: 42px;
    height: 0;
  }

21、爱心

  #square {
    position: relative;
    width: 100px;
    height: 90px;
  }
  #square:before,
  #square:after {
    position: absolute;
    content: "";
    left: 50px;
    top: 0;
    width: 50px;
    height: 80px;
    background: #6bbf20;
    border-radius: 50px 50px 0 0;
    transform: rotate(-45deg);
    transform-origin: 0 100%;
  }
  #square:after {
    left: 0;
    transform: rotate(45deg);
    transform-origin: 100% 100%;
  }

22、无穷大符号

CSS3绘制的基本图形_第19张图片

  #square {
    position: relative;
    width: 212px;
    height: 100px;
    box-sizing: content-box;
  }
  #square:before,
  #square:after {
    content: "";
    box-sizing: content-box;
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 60px;
    border: 20px solid #6bbf20;
    border-radius: 50px 50px 0 50px;
    transform: rotate(-45deg);
  }
  #square:after {
    left: auto;
    right: 0;
    border-radius: 50px 50px 50px 0;
    transform: rotate(45deg);
  }

23、钻石盾牌

  #square {
    width: 0;
    height: 0;
    border: 50px solid transparent;
    border-bottom: 20px solid #6bbf20;
    position: relative;
    top: -50px;
  }
  #square:after {
    content: '';
    position: absolute;
    left: -50px;
    top: 20px;
    width: 0;
    height: 0;
    border: 50px solid transparent;
    border-top: 70px solid #6bbf20;
  }

24、切割钻石

CSS3绘制的基本图形_第20张图片

  #square {
    border-style: solid;
    border-color: transparent transparent #6bbf20 transparent;
    border-width: 0 25px 25px 25px;
    height: 0;
    width: 50px;
    box-sizing: content-box;
    position: relative;
    margin: 20px 0 50px 0;
  }
  #square:after {
    content: "";
    position: absolute;
    top: 25px;
    left: -25px;
    width: 0;
    height: 0;
    border-style: solid;
    border-color: #6bbf20 transparent transparent transparent;
    border-width: 70px 50px 0 50px;
  }

25、鸡蛋

CSS3绘制的基本图形_第21张图片

  #square {
    display: block;
    width: 126px;
    height: 180px;
    background-color: #6bbf20;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  }

26、食逗人(Pac-Man) 

CSS3绘制的基本图形_第22张图片

  #square {
    width: 0px;
    height: 0px;
    border-right: 60px solid transparent;
    border-top: 60px solid #6bbf20;
    border-left: 60px solid #6bbf20;
    border-bottom: 60px solid #6bbf20;
    border-top-left-radius: 60px;
    border-top-right-radius: 60px;
    border-bottom-left-radius: 60px;
    border-bottom-right-radius: 60px;
  }

27、提示对话框

  #square {
    width: 120px;
    height: 80px;
    background: #6bbf20;
    margin-left:20px;
    position: relative;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
  }
  #square:before {
    content: "";
    position: absolute;
    right: 100%;
    top: 26px;
    width: 0;
    height: 0;
    border-top: 13px solid transparent;
    border-right: 26px solid #6bbf20;
    border-bottom: 13px solid transparent;
  }

28、12角星

CSS3绘制的基本图形_第23张图片

  #square {
    background: #6bbf20;
    width: 80px;
    height: 80px;
    margin: 20px;
    position: relative;
    text-align: center;
  }
  #square:before,
  #square:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 80px;
    width: 80px;
    background: #6bbf20;
  }
  #square:before {
    transform: rotate(30deg);
  }
  #square:after {
    transform: rotate(60deg);
  }

29、8角星

CSS3绘制的基本图形_第24张图片

  #square {
    background: #6bbf20;
    width: 80px;
    height: 80px;
    margin: 20px;
    position: relative;
    text-align: center;
    transform: rotate(20deg);
  }
  #square:before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      height: 80px;
      width: 80px;
      background: #6bbf20;
      transform: rotate(135deg);
  }

30、放大镜

CSS3绘制的基本图形_第25张图片

  #square {
    font-size: 10em;
    display: inline-block;
    width: 0.4em;
    box-sizing: content-box;
    height: 0.4em;
    border: 0.1em solid #6bbf20;
    position: relative;
    border-radius: 0.35em;
  }
  #square:before {
    content: "";
    display: inline-block;
    position: absolute;
    right: -0.25em;
    bottom: -0.1em;
    border-width: 0;
    background: #6bbf20;
    width: 0.35em;
    height: 0.08em;
    transform: rotate(45deg);
  }

31、月牙

  #square {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    box-shadow: 15px 15px 0 0 #6bbf20;
  }

32、十字架

CSS3绘制的基本图形_第26张图片

  #square {
    background: #6bbf20;
    height: 100px;
    margin-left: 60px;
    position: relative;
    width: 20px;
  }
  #square:after {
    background: #6bbf20;
    content: "";
    height: 20px;
    left: -40px;
    position: absolute;
    top: 40px;
    width: 100px;
  }

33、指针

  #square {
    width: 200px;
    height: 40px;
    position: relative;
    background: #6bbf20;
  }
  #square:after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 0;
    border-left: 20px solid white;
    border-top: 20px solid transparent;
    border-bottom: 20px solid transparent;
  }
  #square:before {
    content: "";
    position: absolute;
    right: -20px;
    bottom: 0;
    width: 0;
    height: 0;
    border-left: 20px solid #6bbf20;
    border-top: 20px solid transparent;
    border-bottom: 20px solid transparent;
  }

34、阴阳八卦

CSS3绘制的基本图形_第27张图片

  #square {
    width: 96px;
    box-sizing: content-box;
    height: 48px;
    background: #eee;
    border-color: #6bbf20;
    border-style: solid;
    border-width: 2px 2px 50px 2px;
    border-radius: 100%;
    position: relative;
  }
  #square:before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    background: #eee;
    border: 18px solid #6bbf20;
    border-radius: 100%;
    width: 12px;
    height: 12px;
    box-sizing: content-box;
  }
  #square:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    background: #6bbf20;
    border: 18px solid #eee;
    border-radius: 100%;
    width: 12px;
    height: 12px;
    box-sizing: content-box;
  }

 

你可能感兴趣的:(D-CSS)