How to reach CSS zen?
CSS looks like a set of tricks to me. Whenever I read about some css technique, it looks much more like tricks that techniques. When I write CSS, I often need to adapt the html structure and I feel bad.
Did some of you had some enlightenment and enjoy CSS zen ? How did you reach CSS zen ?
First of all, separate content and presentation completely, and I mean COMPLETELY so... no more
(Sadly I see this too much) and all of that other stuff.
css classes (and id's) should describe the content, not define the style. for example, this is perfectly allowed:
<div id="question"> <p>[...]</p> </div> <div id="answers"> <div class="answer"> <p>[...]</p> <div class="comment"><p>[...]</p></div> <div class="comment"><p>[...]</p></div> </div> <div class="answer"> <p>[...]</p> </div> </div>
you have enough tags classes and id's to do something with, yet no diveritis or presentation logic inside it.
remember... the most important thing to reach CSS zen is extremely well-formed HTML without getting diveritis
Also, if you read about a CSS trick, it is usually not very optimised. The example you gave can probably be more generalized, and finally work with normal coding. However the person who found this version didn't pursue it any further, since he found what he needed.
One last note is to design first for content, and include the HTML for features later on.