On Github wiredsister / css101
* Note that proximity of elements in the document tree is irrelevant to specificity
The !important rule is used to override any other declaration in CSS, wherever it is in the declaration list.
Things you shouldn't do:
* Disclaimer: I will not be talking about the majority of display properties. MDN lists over 20. Unless you are interested in experimental CSS3, making your own grid layout, or doing HTML emails, you can read on safely.
Like a ninja, it isn't there. Nor does it affect the layout. All decendents are now hidden and removed from layout. It's like you never were there.
* Note that it visibility : hidden is different in that it will hide the element but the layout will respond like it's still there.
A block-level element is one that takes up a whole new line and stretches out from left to right as far as it can. Most things in your browser's style sheet are by default block-level elements. <div> is possibly the most common you'd encounter. There are also <form>, <p> and HTML5 <header>, <footer>, and <section>.
inline elements go with the flow of the line. For example, elements such as <a> and <span> wrap the text that they surround.
Sometimes you can have your cake and eat it too. The element generates a block element box that will be flowed with surrounding content as if it were a single inline box.
Imagine you had those childhood blocks you played with as a kid. Well, think of the gravity that applied to them as being the "normal flow". If I drop a static <div> on the page it will snap to the top left (in this strange world of boxes, gravity is upside down). If you added another block to the page, you'd see it stack nicely one on top of the other.
* Notice that properties like top, left, right, or bottom do not apply.
relative also acts like your childhood blocks and stacks as you'd expect. However, relative elements can bend the law of gravity. You can offest them and their children exist within the new coordinate plane as the parent.
absolute elements are completely outside of the flow. They dance to the beat of their own drum, locating to a specified position that is relative to its closest positioned ancestor or containing block. Absolutely positioned boxes can have margins, they do not collapse with any other margins.
fixed isn't much different than absolute except it is relative to the viewport (broswer, device window). It doesn't scroll within the document. It's always there.
.clearfix:after { content: "."; visibility: hidden; display: block; height: 0; clear: both; }