Articles Tagged
CSS
Arranging Elements from Top to Bottom instead of Left to Right (float: down?)
Reader Marcin A wrote in with this question about a simple unordered list in which they wanted the elements to be arranged in vertical order (top to bottom) instead of horizontal (left to right). …
Don’t Overthink It Grids
The vast majority of websites out there use a grid. They may not explicitly have a grid system in place, but if they have a “main content area” floated to the left a “sidebar” floated to the right, it’s a …
Things It Might Be Fun/Useful to Try the Universal (*) Selector On
Better Box Sizing
Paul Irish suggests the universal selector (*) to apply border-box
box-sizing
to every element. I’ve been wanting to try this forever because this box model is, in my opinion, just better. Imagine: elements with percentage widths and pixel padding without …
Box Sizing
The box-sizing
property can make building CSS layouts easier and a lot more intuitive. It’s such a boon for developers that here at CSS-Tricks we observe International Box-Sizing Awareness Day in February.
But, how is it so helpful and beloved …
Specifics on CSS Specificity
Let’s specifically cover this subject. (rimshot!)
The best way to explain it is to start with an example of where specificity gets confusing and perhaps doesn’t behave like you would expect. Then we’ll take a closer look at how to …
Child and Sibling Selectors
Do you know what the difference between these selectors are?
ul li { margin: 0 0 5px 0; }
ul li { margin: 0 0 5px 0; }
I’ll admit it took me longer than it probably should have (way …
The Skinny on CSS Attribute Selectors
CSS has the ability to target HTML elements based on any one of their attributes. You probably already know about classes and IDs. Check out this bit of HTML:
<h2 id="title" class="magic" rel="friend"David Walsh</h2
This single element has three …