...

View Full Version : Different CSS for IE



many_tentacles
05-02-2006, 10:50 AM
I am using some different CSS to fix bugs in IE/Win.

I have used the following code but I just wanted to make sure it does not have any problems that i've not heard about.


margin-top: 355px;
_margin-top: 0px;

Thanks

Masterslave
05-02-2006, 11:16 AM
The underscore hack is not valid CSS, use conditional comments instead:


<!--[if IE]><link rel="stylesheet" href="css/front/ie.css" type="text/css" media="screen" /><![endif]-->

ie.css


margin-top: 0;


What do you mean about 'any problems that i've not heard about'?

phauwn
05-02-2006, 01:20 PM
well, I like the irony of using one bug to fix another. Puritanical coders don't like it, but to be honest, I use it pretty frequently. You'll just never be able to get rid of your browser errors. :o

Bill Posters
05-02-2006, 02:10 PM
well, I like the irony of using one bug to fix another. Puritanical coders don't like it, but to be honest, I use it pretty frequently.
No-one I know considers conditional comments a "bug". Proprietory, yes. But a bug? Nah.

Most developers I know, particularly the puritans, increasingly prefer the use of CCs to hacking/loading up their principle stylesheets with proprietory properties, syntax invalidations and other error-based 'filters'.

As a bit of a puritan myself, I prefer CCs to the alternatives and wouldn't mind seeing conditional comments brought into the standard, with each UA supplying their own 2-character own ident code.

Arbitrator
05-02-2006, 09:49 PM
No-one I know considers conditional comments a "bug". Proprietory, yes. But a bug? Nah.

As a bit of a puritan myself, I prefer CCs to the alternatives and wouldn't mind seeing conditional comments brought into the standard, with each UA supplying their own 2-character own ident code.Yeah, a bug is an unintended effect heh. CCs exist and function for their intended purposes and for that reason they're more reliable than hacks which tend to rely on broken CSS support and parsing bugs; when or if those are fixed down the road, those that use hacks will end up with broken pages in IE.

I wouldn't mind seeing all browsers having a form of CCs either for the sake of convenience. However, the downside is that it might encourage browser vendors to be more lax in upholding the standards since they could just say "code for our browser specifically because we're right, problem solved". If a programmer's code wasn't working they could also just use this as a window out rather than searching for a real solution. Code that doesn't work isn't always the browser's fault; sometimes it's just bad design and poor code on the programmer's part.

felgall
05-02-2006, 11:12 PM
The CCs are valid HTML comments. The only difference is that IE understands them as if statements to include extra code. This is no different from the way that server side includes are valid HTML comments that are replaced by the SSI parser before serving the page. Selective processing comments like this is probably the tidiest way that browser specific functionality can be handled and including CSS or Javascript inside of CCs is the ONLY way of making it specific to IE as all hacks and browser detection tests have the potential to misidentify browsers and screw things up.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum