Wednesday 28 March 2007 9:58:07 pm
Not sure if this is really the right forum for these questions, but here's my thoughts: 1. Your naming conventions should reflect the semantic meaning of the code. If you change the formatting later (and I'm talking about CSS here) the class or id name should still apply.
2. A big CSS file is much, much better than big HTML files! From what you say though I suspect that you are suffering from 'Class Overproduction' - you are giving elements classes instead of using your selectors. It is much better to give your content an id of 'content' and then use selectors such as #content p, #content table td etc than give the p elements classes *unless they need a style which is different to the one they normally use in that context*. I tend to find that only about 10% of my CSS rules address a class, the rest just address elements by their context. The best tip I can think of to write good CSS is use the Web Developer http://chrispederick.com/work/webdeveloper/ extension for Firefox, and use the Outline Current Element function to see where in the DOM the element you are trying to address is. 3. I tend to comment my CSS fairly heavily, and my HTML not much at all. There shouldn't be much in the HTML besides content anyway. As far as eZpublish template files go: if you spend two hours working out how to do something, comment it. Commenting is also good for others who may need to try and unpick your work later. Try to imagine you are encountering the code for the first time, would it make sense without explanation? Of course the next step in commenting is write down how you achieved that nifty little code trick, and the best place for that is here.
Paul Bolger
|