>웹 프론트엔드 >HTML 튜토리얼 >CSS3로 다양한 그래픽 만들기 (1)

CSS3로 다양한 그래픽 만들기 (1)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB원래의
2016-09-05 08:45:381242검색

1、정사각형

 

<span style="color: #800000;">#square </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 100px</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 100px</span>;<span style="color: #ff0000;"> <br>background</span>:<span style="color: #0000ff;"> red</span>; }

 

2、직사각형

 

<span style="color: #800000;">#rectangle </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 200px</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 100px</span>;<span style="color: #ff0000;"> <br>background</span>:<span style="color: #0000ff;"> red</span>; }

3、원

 

<span style="color: #800000;">#circle </span>{<br><span style="color: #ff0000;"> width</span>:<span style="color: #0000ff;"> 100px</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 100px</span>;<span style="color: #ff0000;"> <br>background</span>:<span style="color: #0000ff;"> red</span>;<span style="color: #ff0000;"> <br>-moz-border-radius</span>:<span style="color: #0000ff;"> 50px</span>;<span style="color: #ff0000;"> <br>-webkit-border-radius</span>:<span style="color: #0000ff;"> 50px</span>;<span style="color: #ff0000;"> border-radius</span>:<span style="color: #0000ff;"> 50px</span>; }<br> <span style="color: #008000;">/*</span><span style="color: #008000;"> Cleaner, but slightly less support: use "50%" as value </span><span style="color: #008000;">*/</span>

4、타원형

 

<span style="color: #800000;">#oval </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 200px</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 100px</span>;<span style="color: #ff0000;"> <br>background</span>:<span style="color: #0000ff;"> red</span>;<span style="color: #ff0000;"> <br>-moz-border-radius</span>:<span style="color: #0000ff;"> 100px / 50px</span>;<span style="color: #ff0000;"> <br>-webkit-border-radius</span>:<span style="color: #0000ff;"> 100px / 50px</span>;<span style="color: #ff0000;"> <br>border-radius</span>:<span style="color: #0000ff;"> 100px / 50px</span>; } <br><span style="color: #008000;">/*</span><span style="color: #008000;"> Cleaner, but slightly less support: use "50%" as value </span><span style="color: #008000;">*/</span>

5、위쪽 삼각형

 

<span style="color: #800000;">#triangle-up </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>border-left</span>:<span style="color: #0000ff;"> 50px solid transparent</span>;<span style="color: #ff0000;"> <br>border-right</span>:<span style="color: #0000ff;"> 50px solid transparent</span>;<span style="color: #ff0000;"> <br>border-bottom</span>:<span style="color: #0000ff;"> 100px solid red</span>; }

 

6、아래쪽 삼각형

 

<span style="color: #800000;">#triangle-down </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>border-left</span>:<span style="color: #0000ff;"> 50px solid transparent</span>;<span style="color: #ff0000;"> <br>border-right</span>:<span style="color: #0000ff;"> 50px solid transparent</span>;<span style="color: #ff0000;"> <br>border-top</span>:<span style="color: #0000ff;"> 100px solid red</span>; }

7、왼쪽 삼각형

 

<span style="color: #800000;">#triangle-left </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>border-top</span>:<span style="color: #0000ff;"> 50px solid transparent</span>;<span style="color: #ff0000;"> <br>border-right</span>:<span style="color: #0000ff;"> 100px solid red</span>;<span style="color: #ff0000;"> <br>border-bottom</span>:<span style="color: #0000ff;"> 50px solid transparent</span>; }

8、삼각형 오른쪽

<span style="color: #800000;">#triangle-right </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>border-top</span>:<span style="color: #0000ff;"> 50px solid transparent</span>;<span style="color: #ff0000;"> <br>border-left</span>:<span style="color: #0000ff;"> 100px solid red</span>;<span style="color: #ff0000;"> <br>border-bottom</span>:<span style="color: #0000ff;"> 50px solid transparent</span>; }

9、왼쪽 위 삼각형

 

<span style="color: #800000;">#triangle-topleft </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>border-top</span>:<span style="color: #0000ff;"> 100px solid red</span>;<span style="color: #ff0000;"> <br>border-right</span>:<span style="color: #0000ff;"> 100px solid transparent</span>; }

10、삼각형 상단 오른쪽

 

<span style="color: #800000;">#triangle-topright </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>border-top</span>:<span style="color: #0000ff;"> 100px solid red</span>;<span style="color: #ff0000;"> <br>border-left</span>:<span style="color: #0000ff;"> 100px solid transparent</span>; }

11、왼쪽 아래 삼각형

 

<span style="color: #800000;">#triangle-bottomleft </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>border-bottom</span>:<span style="color: #0000ff;"> 100px solid red</span>;<span style="color: #ff0000;"> <br>border-right</span>:<span style="color: #0000ff;"> 100px solid transparent</span>; }

12、삼각형 하단 오른쪽

 

<span style="color: #800000;">#triangle-bottomright </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>border-bottom</span>:<span style="color: #0000ff;"> 100px solid red</span>;<span style="color: #ff0000;"> <br>border-left</span>:<span style="color: #0000ff;"> 100px solid transparent</span>; }

13、곡선 꼬리 화살표

 

<span style="color: #800000;">#curvedarrow </span>{<span style="color: #ff0000;"> <br>position</span>:<span style="color: #0000ff;"> relative</span>;<br><span style="color: #ff0000;"> width</span>:<span style="color: #0000ff;"> 0</span>;<br><span style="color: #ff0000;"> height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> border-top</span>:<span style="color: #0000ff;"> 9px solid transparent</span>;<br><span style="color: #ff0000;"> border-right</span>:<span style="color: #0000ff;"> 9px solid red</span>;<span style="color: #ff0000;"> <br>-webkit-transform</span>:<span style="color: #0000ff;"> rotate(10deg)</span>;<br><span style="color: #ff0000;"> -moz-transform</span>:<span style="color: #0000ff;"> rotate(10deg)</span>;<span style="color: #ff0000;"> <br>-ms-transform</span>:<span style="color: #0000ff;"> rotate(10deg)</span>;<br><span style="color: #ff0000;"> -o-transform</span>:<span style="color: #0000ff;"> rotate(10deg)</span>; <br>}<span style="color: #800000;"> <br>#curvedarrow:after </span>{<span style="color: #ff0000;"> <br>content</span>:<span style="color: #0000ff;"> ""</span>;<span style="color: #ff0000;"> <br>position</span>:<span style="color: #0000ff;"> absolute</span>;<br><span style="color: #ff0000;"> border</span>:<span style="color: #0000ff;"> 0 solid transparent</span>;<span style="color: #ff0000;"> <br>border-top</span>:<span style="color: #0000ff;"> 3px solid red</span>;<span style="color: #ff0000;"> <br>border-radius</span>:<span style="color: #0000ff;"> 20px 0 0 0</span>;<span style="color: #ff0000;"> <br>top</span>:<span style="color: #0000ff;"> -12px</span>;<span style="color: #ff0000;"> <br>left</span>:<span style="color: #0000ff;"> -9px</span>;<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 12px</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 12px</span>;<span style="color: #ff0000;"> <br>-webkit-transform</span>:<span style="color: #0000ff;"> rotate(45deg)</span>;<span style="color: #ff0000;"> <br>-moz-transform</span>:<span style="color: #0000ff;"> rotate(45deg)</span>;<span style="color: #ff0000;"> <br>-ms-transform</span>:<span style="color: #0000ff;"> rotate(45deg)</span>;<span style="color: #ff0000;"> <br>-o-transform</span>:<span style="color: #0000ff;"> rotate(45deg)</span>; }

14、사다리꼴

 

<span style="color: #800000;">#trapezoid </span>{<span style="color: #ff0000;"> <br>border-bottom</span>:<span style="color: #0000ff;"> 100px solid red</span>;<span style="color: #ff0000;"> <br>border-left</span>:<span style="color: #0000ff;"> 50px solid transparent</span>;<span style="color: #ff0000;"> <br>border-right</span>:<span style="color: #0000ff;"> 50px solid transparent</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 100px</span>; }

15、평행사변형

 

<span style="color: #800000;">#parallelogram </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 150px</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 100px</span>;<span style="color: #ff0000;"> <br>-webkit-transform</span>:<span style="color: #0000ff;"> skew(20deg)</span>;<span style="color: #ff0000;"> <br>-moz-transform</span>:<span style="color: #0000ff;"> skew(20deg)</span>;<span style="color: #ff0000;"> <br>-o-transform</span>:<span style="color: #0000ff;"> skew(20deg)</span>;<span style="color: #ff0000;"> <br>background</span>:<span style="color: #0000ff;"> red</span>; }

16、별표(6점)

 

<span style="color: #800000;">#star-six </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>border-left</span>:<span style="color: #0000ff;"> 50px solid transparent</span>;<span style="color: #ff0000;"> <br>border-right</span>:<span style="color: #0000ff;"> 50px solid transparent</span>;<span style="color: #ff0000;"> <br>border-bottom</span>:<span style="color: #0000ff;"> 100px solid red</span>;<span style="color: #ff0000;"> <br>position</span>:<span style="color: #0000ff;"> relative</span>; }<span style="color: #800000;"> <br>#star-six:after </span>{<span style="color: #ff0000;"> <br>width</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> <br>border-left</span>:<span style="color: #0000ff;"> 50px solid transparent</span>;<span style="color: #ff0000;"> <br>border-right</span>:<span style="color: #0000ff;"> 50px solid transparent</span>;<span style="color: #ff0000;"> <br>border-top</span>:<span style="color: #0000ff;"> 100px solid red</span>;<span style="color: #ff0000;"> <br>position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;"> <br>content</span>:<span style="color: #0000ff;"> ""</span>;<span style="color: #ff0000;"> <br>top</span>:<span style="color: #0000ff;"> 30px</span>;<span style="color: #ff0000;"> <br>left</span>:<span style="color: #0000ff;"> -50px</span>; }

17、별표(5점)

 

<span style="color: #800000;">#star-five </span>{<span style="color: #ff0000;">
 margin</span>:<span style="color: #0000ff;"> 50px 0</span>;<span style="color: #ff0000;"> 
position</span>:<span style="color: #0000ff;"> relative</span>;<span style="color: #ff0000;"> 
display</span>:<span style="color: #0000ff;"> block</span>;<span style="color: #ff0000;"> 
color</span>:<span style="color: #0000ff;"> red</span>;<span style="color: #ff0000;"> 
width</span>:<span style="color: #0000ff;"> 0px</span>;<span style="color: #ff0000;"> 
height</span>:<span style="color: #0000ff;"> 0px</span>;<span style="color: #ff0000;"> 
border-right</span>:<span style="color: #0000ff;"> 100px solid transparent</span>;<span style="color: #ff0000;"> 
border-bottom</span>:<span style="color: #0000ff;"> 70px solid red</span>;<span style="color: #ff0000;"> 
border-left</span>:<span style="color: #0000ff;"> 100px solid transparent</span>;<span style="color: #ff0000;">
 -moz-transform</span>:<span style="color: #0000ff;"> rotate(35deg)</span>;<span style="color: #ff0000;"> 
-webkit-transform</span>:<span style="color: #0000ff;"> rotate(35deg)</span>;<span style="color: #ff0000;">
 -ms-transform</span>:<span style="color: #0000ff;"> rotate(35deg)</span>;<span style="color: #ff0000;">
 -o-transform</span>:<span style="color: #0000ff;"> rotate(35deg)</span>; }<span style="color: #800000;">
 #star-five:before </span>{<span style="color: #ff0000;"> 
border-bottom</span>:<span style="color: #0000ff;"> 80px solid red</span>;<span style="color: #ff0000;"> 
border-left</span>:<span style="color: #0000ff;"> 30px solid transparent</span>;<span style="color: #ff0000;"> 
border-right</span>:<span style="color: #0000ff;"> 30px solid transparent</span>;<span style="color: #ff0000;"> 
position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;"> 
height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;">
 width</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;">
 top</span>:<span style="color: #0000ff;"> -45px</span>;<span style="color: #ff0000;"> 
left</span>:<span style="color: #0000ff;"> -65px</span>;<span style="color: #ff0000;"> 
display</span>:<span style="color: #0000ff;"> block</span>;<span style="color: #ff0000;">
 content</span>:<span style="color: #0000ff;"> ''</span>;<span style="color: #ff0000;"> 
-webkit-transform</span>:<span style="color: #0000ff;"> rotate(-35deg)</span>;<span style="color: #ff0000;"> 
-moz-transform</span>:<span style="color: #0000ff;"> rotate(-35deg)</span>;<span style="color: #ff0000;"> -
ms-transform</span>:<span style="color: #0000ff;"> rotate(-35deg)</span>;<span style="color: #ff0000;"> 
-o-transform</span>:<span style="color: #0000ff;"> rotate(-35deg)</span>; }<span style="color: #800000;">
 #star-five:after </span>{<span style="color: #ff0000;"> 
position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;"> 
display</span>:<span style="color: #0000ff;"> block</span>;<span style="color: #ff0000;">
 color</span>:<span style="color: #0000ff;"> red</span>;<span style="color: #ff0000;"> 
top</span>:<span style="color: #0000ff;"> 3px</span>;<span style="color: #ff0000;"> 
left</span>:<span style="color: #0000ff;"> -105px</span>;<span style="color: #ff0000;"> 
width</span>:<span style="color: #0000ff;"> 0px</span>;<span style="color: #ff0000;"> 
height</span>:<span style="color: #0000ff;"> 0px</span>;<span style="color: #ff0000;">
 border-right</span>:<span style="color: #0000ff;"> 100px solid transparent</span>;<span style="color: #ff0000;">
 border-bottom</span>:<span style="color: #0000ff;"> 70px solid red</span>;<span style="color: #ff0000;"> 
border-left</span>:<span style="color: #0000ff;"> 100px solid transparent</span>;<span style="color: #ff0000;">
 -webkit-transform</span>:<span style="color: #0000ff;"> rotate(-70deg)</span>;<span style="color: #ff0000;">
 -moz-transform</span>:<span style="color: #0000ff;"> rotate(-70deg)</span>;<span style="color: #ff0000;"> 
-ms-transform</span>:<span style="color: #0000ff;"> rotate(-70deg)</span>;<span style="color: #ff0000;"> 
-o-transform</span>:<span style="color: #0000ff;"> rotate(-70deg)</span>;<span style="color: #ff0000;"> 
content</span>:<span style="color: #0000ff;"> ''</span>; }

18、펜타곤

 

<span style="color: #800000;">#pentagon </span>{<span style="color: #ff0000;"> 
position</span>:<span style="color: #0000ff;"> relative</span>;<span style="color: #ff0000;"> 
width</span>:<span style="color: #0000ff;"> 54px</span>;<span style="color: #ff0000;"> 
border-width</span>:<span style="color: #0000ff;"> 50px 18px 0</span>;<span style="color: #ff0000;"> 
border-style</span>:<span style="color: #0000ff;"> solid</span>;<span style="color: #ff0000;"> 
border-color</span>:<span style="color: #0000ff;"> red transparent</span>; }<span style="color: #800000;"> 
#pentagon:before </span>{<span style="color: #ff0000;"> content</span>:<span style="color: #0000ff;"> ""</span>;<span style="color: #ff0000;"> 
position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;"> 
height</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;">
 width</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;">
 top</span>:<span style="color: #0000ff;"> -85px</span>;<span style="color: #ff0000;">
 left</span>:<span style="color: #0000ff;"> -18px</span>;<span style="color: #ff0000;">
 border-width</span>:<span style="color: #0000ff;"> 0 45px 35px</span>;<span style="color: #ff0000;"> 
border-style</span>:<span style="color: #0000ff;"> solid</span>;<span style="color: #ff0000;"> 
border-color</span>:<span style="color: #0000ff;"> transparent transparent red</span>; }

 

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.