Page 1 of 1

ie conditional comments

Posted: Wed Oct 27, 2004 3:18 pm
by rehfeld
just wanted to hear some opinions on why people commonly use hacks to
make ie behave, instead of conditional comments

my issue w/ (most, not all) hacks is that they may fail when the next version of ie is released.

to me, conditional comments seem like the most fail safe method of feeding(or restricting) styles to ie. I agree, its not always the easiest and fastest method,
but it always validates, and if used correctly, are very likely not to cause problems in future versions of ie.

now i do realize you cant accomplish everything w/ it that you can w/ hacks, but thats not what im referring to. Sometimes hacks are definately the best route, but at least in my experience, ive found conditional comments are the best choice, most of the time.

edited - ive changed the title and this post. i was using the term "conditional statements", when this is most commonly called conditional comments. sorry for the confusion

Posted: Wed Oct 27, 2004 3:38 pm
by kettle_drum
Well when you start to work with designers and your job is just to code you seperate the php from the design markup and so dont have the option to run if statments. So that makes it harder to do as you suggest. Then there is just the feeling that php isnt for marking up and so you leave the design of the page for html/xhtml/css which can cope with different browsers - and keep php for doing the hard work of getting and processing the data. Then there is also the feeling that they are no longer hacks, but requirments for cross-browser development.

Posted: Wed Oct 27, 2004 4:48 pm
by rehfeld
sorry, i wasnt very clear i guess.

i meant in the html, nothing to do w/ scripting

Code: Select all

<html>
<head>

<link rel="stylesheet" href="all-browsers.css" type="text/css">

<!--&#1111;if ie 5]>

<link rel="stylesheet" href="ie5.css" type="text/css">

<!&#1111;endif]-->

</head>

Posted: Fri Oct 29, 2004 4:45 pm
by andre_c
The very first thing that i do is add a doctype. This makes IE behave in Standards-compliance mode, which removes a few important rendering differences between IE and other browsers like firefox. After that, usually the hacks I have to make to deal with ie are minimal.

Posted: Sun Oct 31, 2004 5:09 pm
by rehfeld
well yes, i agree using a doctype is important when trying to acheive consitent behavior from browsers,
but what im asking is why do people choose to use hacks over conditional comments?


http://msdn.microsoft.com/library/defau ... nt_ovw.asp