CSS semantics; selecting elements directly or via order

Posted by Joshua Cody on Stack Overflow See other posts from Stack Overflow or by Joshua Cody
Published on 2010-03-22T00:56:40Z Indexed on 2010/03/22 1:01 UTC
Read the original article Hit count: 416

Filed under:
|
|

Perhaps this question has been asked elsewhere, but I'm unable to find it. With HTML5 and CSS3 modules inching closer, I'm getting interested in a discussion about the way we write CSS.

Something like this where selection is done via element order and type is particularly fascinating. The big advantage to this method seems to be complete modularization of HTML and CSS to make tweaks and redesigns simpler.

At the same time, semantic IDs and classes seem advantageous for sundry reasons. Particularly, direct linking, JS targeting, and shorter CSS selectors. Also, it seems selector length might be an issue. For instance, I just wrote the following, which would be admittedly easier using some semantic HTML5 elements:

body>div:nth-child(2)>div:nth-child(2)>ul:nth-child(2)>li:last-child

So what say you, Stack Overflow? Is the future of CSS writing focused on element order and type? Or are IDs and classes and the current ways here to stay?

(I'm well aware the IDs and classes have their place, although I am interested to hear more ways you think they'll continue to be necessary. The discussion I'm interested in is bigger-picture and the ways writing CSS is changing.)

© Stack Overflow or respective owner

Related posts about css

Related posts about css3