PDA

View Full Version : Change css attribute for IE6



Obi Wan
December 20th, 2008, 04:08 PM
Hi everyone I have a problem someone might be able to help me with. I designed a site
for a friend and it looks great in IE7 and on safari or firefox. But in IE6 the margin is slightly off. I tried entering the following in the header of my page where I want to adjust the class if the enduser is using IE6

Here is what I have in my header to fix the IE problem but it doesnt adjust the margin:




<!--[if lt IE 6]>
<style type="text/css" media="screen">
.presidentSection
{
margin:0 0 0 100px;
}
</style>
<![endif]-->




This is what I have in my main.css which works fine in IE7 and firefox




.presidentSection
{
padding:0;
margin:0 0 0 180px;
height:296px;
width:167px;
float:left;
}




This is the xhtml that I am trying to correct:




<!-- pres section -->
<div class="execRowTop">
<div class="presidentSection"><img src="images/exec_board/name.jpg" />
<div class="committeTitleContainer">
<h4>President</h4>
<br />
<a href=""><img src="images/content/mail_icon.gif" class="mailIcon" /></a> <span class="name">Name</span>
</div>
</div>
</div>



Any help is appreciated, I am thinking I am not targeting the div correctly. can anyone help please.

birdwing
December 20th, 2008, 10:59 PM
Can you provide us a link to the stie so we can see the problem you are getting.

creativeFuzion
December 21st, 2008, 09:07 PM
Could this be because your code reads as follows:


<!--[if lt IE 6]>When your code should read like this:


<!--[if IE 6]>What you are doing is excluding IE 6 from your tweak. You need to remove the lt (which means less than; hence only affecting IE 5 and lower) and things should run as planned.

redelite
December 21st, 2008, 10:59 PM
Just a suggestion, what I usually do is don't worry about anything less than IE6. So with that said, I use this conditional:



<!--[if lt IE7]>

creativeFuzion
December 22nd, 2008, 12:38 AM
Just a suggestion, what I usually do is don't worry about anything less than IE6. So with that said, I use this conditional:



<!--[if lt IE7]>


Don't you mean IE 7?

redelite
December 22nd, 2008, 01:21 AM
No.. ...well I suppose I could just do it as:



<!--[if IE6]>


That's just the way I've always done my "hacks".. Less Than IE7...


**Edit: nvm I'll just shut up :lol:.. I totally screwed that up..

creativeFuzion
December 22nd, 2008, 02:11 AM
If you do not separate the terms IE and [IE version; Eg: 6] like so:


<!--[if IE 6]>It will not parse correctly. Currently you have:

Incorrect:

!--[if IE6]>

Correct:

!--[if IE 6]>

redelite
December 22nd, 2008, 10:20 AM
Ya, I got that, that's why I just said nevermind I screwed that all up.. more than just that :P