Heim > Artikel > Web-Frontend > Erstellen Sie verschiedene Grafiken mit CSS3 (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>; }
<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>; }
<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>
<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>
<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>; }
<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>; }
<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>; }
<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>; }
<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>; }
<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>; }
<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>; }
<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>; }
<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>; }
<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>; }
<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>; }
<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>; }
<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>; }
<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>; }