Tim Offenstein wrote: > I'm seeing a number > of students mark up their XHTML with descriptively named DIVs that > have no counterpart in the CSS.
This is a general design issue and about markup, not CSS. >From the CSS perspective, there are some risks, whether you mean classes or ids (or both) by "names". The "names" may pollute the name space, especially if people do not realize that id attributes must be unique. For example, I have seen a stituation with two id attributes (in code that I cannot change in any direct way) that differ in case of letters only, and it seems that when you have id="foo" and id="Foo" (violating HTML rules), browsers won't treat either of them as matching the selector #foo (or #Foo)! Similarly, if lots of class attributes are used extensively and carelessly, you might notice that setting properties for .bar sets them for elements you weren't thinking about (since in the past you forgot, I you had used class="bar" somewhere, or a previous author of the page did). These can however be avoided by good general design and documentation, which is needed anyway, to keep track of the classes and ids you really need. On the positive side, understandability of HTML source code is useful when you later modify or debug the CSS code. "Extra" names can be handy later in styling, as already mentioned in this discussion. And they can be indispensable to users who wish (or need) to set up a user style sheet for viewing the page: they cannot change the markup, they have to work with the "hooks" offered by classes, ids, and maybe other attributes present in the source, > If this is an attempt to section/categorize the > code, simple HTML comments will serve the purpose much better. HTML comments are risky and clumsy. It's too easy to make a mistake in typing the <!-- and --> as well as use -- inside the comment. In CSS, comments are safer; their main problems are that they consume bandwidth (since comments are sent along with CSS code every time a browser requests for it) and that they they to degrade by time (people change code but don't update the comments). Yucca ______________________________________________________________________ css-discuss [cs...@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/