Saturday, June 10

Tag: Shapes of CSS

CSS Tricks

The Shapes of CSS

CSS is capable of making all sorts of shapes. Squares and rectangles are easy, as they are the natural shapes of the web. Add a width and height and you have the exact size rectangle you need. Add border-radius and you can round that shape, and enough of it you can turn those rectangles into circles and ovals.We also get the ::before and ::after psuedo elements in CSS, which give us the potential of two more shapes we can add to the original element. By getting clever with positioning, transforming, and many other tricks, we can make lots of shapes in CSS with only a single HTML element. Square#square { width: 100px; height: 100px; background: red; }Rectangle#rectangle { width: 200px; height: 100px; background: red; }Circle#circle { wid...