The Artima Developer Community
Sponsored Link

Web Buzz Forum
CSS hacks and server-side code

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Stuart Langridge

Posts: 2006
Nickname: aquarius
Registered: Sep, 2003

Stuart Langridge is a web, JavaScript, and Python hacker, and sometimes all three at once.
CSS hacks and server-side code Posted: Aug 24, 2005 12:44 AM
Reply to this message Reply

This post originated from an RSS feed registered with Web Buzz by Stuart Langridge.
Original Post: CSS hacks and server-side code
Feed Title: as days pass by
Feed URL: http://feeds.feedburner.com/kryogenix
Feed Description: scratched tallies on the prison wall
Latest Web Buzz Posts
Latest Web Buzz Posts by Stuart Langridge
Latest Posts From as days pass by

Advertisement

Scott Isaacs, one of the Microsoft web chaps, is complaining about CSS hacks. His proposed solution is to, instead of applying CSS hacks to make a browser do what you want, instead have details of the users browser inserted into the HTML element either by server-side or client-side script. So, if you visit a page using IE6.0, it would add class="ie m6 d0 win" to the HTML element; using Firefox 1.06 on Linux it would add class="firefox m1 d06 linux", and so on. Then, in your stylesheet, use these hooks to apply style for specific browsers.
I think that this is not a good idea, and here’s why.
Firstly, it requires absolutely that every page be server-parsed, since you can’t rely on client-side scripting being there. Well, unless you’re prepared to make your styling depend on JavaScript, which rather defeats the point of CSS. In some places it seems like the norm is to make all pages, even ones with plain HTML and no dynamic content at all, be server-parsed by making them ASP or PHP, but I don’t like to do that for pages that don’t need it. If you’re thinking “but every page needs a header and that’s normally dynamically included!“, think about automatically generated pages which are generated dynamically when required and then cached, like blog archives. Or think about mailing list archives, or pages where the header and footer are added by your web editing tool like Frontpage or Dreamweaver rather than by the server.
Secondly, it clutters the HTML a bit. Not much, but a bit. This isn’t much of an objection.
Thirdly, how do you establish the platform and short-name-for-a-browser and major and minor versions? Parse the userAgent string? That takes us back to the days of browscap.ini and The World’s Biggest List Of Browsers, which you have to rely on someone to maintain.
In short, I don’t like the idea. I’d be interested in hearing dissenting opinions, though.

(Incidentally, you may be thinking that this should have been a comment over at Scott’s rather than a post here: I agree with you, but to post there you need an MSN passport and I don’t want to get one.)

Read: CSS hacks and server-side code

Topic: Plugging Firefox Secrets Previous Topic   Next Topic Topic: Desktop Update

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use