Cameron Adams wrote:

If you think about it, ordering IDs in the order that
they appear in the HTML goes against the grain of
XHTML/CSS separation of content and style.

If you change the position of an object in the HTML,
then you have to change it in the CSS, otherwise your
order becomes meaningless. The best way is to have an
order independent of the HTML content, such as
alphabetical.

From a purely theoretical point of view, that makes some sense. However the content and presentation are separate. They just reference each other. It's a bit like saying that you shouldn't use a selector because it's referencing something in the HTML and thus it's not separate.


I agree that if you decide to change the order of the HTML then you really should go back and change the order of your CSS. However how often does that happen? By your argument you shouldn't really be changing the order of something in the HTML because your mark-up should be independent of the presentation. If you want to move something around you should do it in the CSS. Obviously that's neither practical or often either possible, but if we're talking theory...

Ordering alphabetically just seems wrong to me. It's a bit like ordering your PHP of Javascript functions alphabetically rather than the order they are used/needed in. Great of you can remember off the top of your head what everything is called, but a bugger if you can't.

If you order things by their appearance in the HTML then another developer wanting to change the text style in the footer just needs to open up the CSS and scroll to the bottom. They don't need to open the HTML first to find the name of your ID (myfooter) and then scroll around in the CSS looking for that ID. If you do thing alphabetically tou'll end up with related items (e.g. #home #myfooter) compleatly seporated in the CSS which could make life really difficult for a new developer.

I'm not saying my approach is the best, because it isn't. However it makes the most sense to me and is easy to use on medium sized sites. The problems start occurring if you have very large sites with lost of CSS and different page templates. Then the model starts to break down.

Andy Budd

http://www.message.uk.com/

******************************************************
The discussion list for  http://webstandardsgroup.org/

Proud presenters of Web Essentials 04 http://we04.com/
Web standards, accessibility, inspiration, knowledge
To be held in Sydney, September 30 and October 1, 2004

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************



Reply via email to