how do i write an IE hack?

anna

New Member
I need to change the placement of an element on my page specifically for IE. How do I write a rule that will target just IE's placement of this element?

For instance:
Here is the code for FF

.sepsci {
font-family: Arial, Helvetica, sans-serif;
font-style: italic;
font-weight: bold;
color: #7f7f7f;
position: absolute;
left: 647px;
top: 105px;
}

I need to move the left value 10 px to 657px instead of 647px for IE. How do I write this rule? Thank you for any help!
 

PixelPusher

Super Moderator
Staff member
The code for a conditional statement in IE is written like this:

HTML:
<!--[if condition]>  HTML <![endif]-->

Pretty much saying, "if this is IE, add this html markup, otherwise add nothing."
 

anna

New Member
Thanks Pixel! I googled it too, (gotta love google) and finally got it to work!

It is surprisingly easy!! :) Whoo hoo My pages look right in different browsers!
 

darrenfox

New Member
I also like CSS hacks, mainly for that damn IE6. Simple use an underscore before the property. For example:

#box {
padding: 10px;
_padding: 6px;
}
 

gerdonhanry

New Member
When I have some CSS that just won't work in IE, I see if adding a ZOOM property of 1 (one) will help:

Launch code in new window » Download code as text file »

* div {
* zoom: 1 ;
* }

I have to say, 90% of the time, this fixes the display issues that I am having in IE... and, it does so without adversely affecting any of the other browsers (that I have tested). I guess you could call this an IE-hack since I believe the zoom property is only supported by Internet Explorer.
 

anna

New Member
I have a feeling I will be using these quite often! :) Damn you internet explorer! *makes sign of evil eye*
 
Top