CSS - צורות


CSS - צורות
כשאנו בונים ומעצבים אתר / בלוג אנו משתמשים בתמונות ואלמנטים גרפיים מה שמכביד ומאט את חוויית הגלישה. לפניכם כמה צורות ואלמנטים גרפיים והכל בעזרת CSS שיעשו את אותה עבודה.











מרובע



#square { width: 100px; height: 100px; background: blue; }

מלבן



#rectangle { width: 200px; height: 100px; background: blue; }

עיגול



#circle { width: 100px; height: 100px; background: blue; -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; }

אובלי



#oval { width: 200px; height: 100px; background: blue; -moz-border-radius: 100px / 50px; -webkit-border-radius: 100px / 50px; border-radius: 100px / 50px; }

משולש - עליון



#triangle-up { width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 100px solid blue; }

משולש - תחתון



#triangle-down { width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-top: 100px solid blue; }

משולש - שמאלה



#triangle-left { width: 0; height: 0; border-top: 50px solid transparent; border-right: 100px solid blue; border-bottom: 50px solid transparent; }

משולש - ימינה



#triangle-right { width: 0; height: 0; border-top: 50px solid transparent; border-left: 100px solid blue; border-bottom: 50px solid transparent; }

משולש - פינה עליון שמאל



#triangle-topleft { width: 0; height: 0; border-top: 100px solid blue; border-right: 100px solid transparent; }

משולש - פינה עליון ימין



#triangle-topright { width: 0; height: 0; border-top: 100px solid blue; border-left: 100px solid transparent; }

משולש - פינה תחתון שמאל



#triangle-bottomleft { width: 0; height: 0; border-bottom: 100px solid blue; border-right: 100px solid transparent; }

משולש - פינה תחתון ימין



#triangle-bottomright { width: 0; height: 0; border-bottom: 100px solid blue; border-left: 100px solid transparent; }

כוכב - שש צלעות - מגן דויד




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

מחומש





#pentagon { position: relative; width: 54px; border-width: 50px 18px 0; border-style: solid; border-color: blue 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 blue; }

משושה





#hexagon { width: 100px; height: 55px; background: blue; position: relative; }
#hexagon: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 blue; }
#hexagon: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 blue; }

מתומן



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

ביצה



#egg { display:block; width: 126px; height: 180px; background-color: blue; -webkit-border-radius: 63px 63px 63px 63px / 108px 108px 72px 72px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }

פאקמן



#pacman { width: 0px; height: 0px; border-right: 60px solid transparent; border-top: 60px solid blue; border-left: 60px solid blue; border-bottom: 60px solid blue; border-top-left-radius: 60px; border-top-right-radius: 60px; border-bottom-left-radius: 60px; border-bottom-right-radius: 60px; }

בועת שיחה



#talkbubble { width: 120px; height: 80px; background: blue; 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 blue; border-bottom: 13px solid transparent; }

טלויזיה



#tv { position: relative; width: 200px; height: 150px; margin: 20px 0; background: blue; border-radius: 50% / 10%; color: white; text-align: center; text-indent: .1em; }
#tv:before { content: ''; position: absolute; top: 10%; bottom: 10%; right: -5%; left: -5%; background: inherit; border-radius: 5% / 50%; }

זכוכית מגדלת




#magnifying-glass { font-size: 10em; /* This controls the size. */ display: inline-block; width: 0.4em; height: 0.4em; border: 0.1em solid blue; position: relative; border-radius: 0.35em; }
#magnifying-glass::before { content: ""; display: inline-block; position: absolute; right: -0.25em; bottom: -0.1em; border-width: 0; background: blue; width: 0.35em; height: 0.08em; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); -o-transform: rotate(45deg); }


אין תגובות:

הוסף רשומת תגובה