Log in

View Full Version : Position problems in IE



shauny1986
01-22-2009, 04:23 PM
website is: http://www.shaunybaby.co.uk

The part that's the problem is the 'ads' on the right. In mozilla they're perfectly positioned. However, in IE they're pushed underneth and I've tried nearly everything to try and reposition them.

Would be amazingly greatful if someone could lend some insight on this. Here's the code for the ads on the right:


.rightads {
float: left;
position:relative;
text-align:center;
width: 150px;
margin-left:0px;
margin-bottom: 10px;
margin-top:-87px;
padding:0;
}
.rightads_container{
padding-left:0px;
padding-top:10px;
}
.rightads_ad {
margin:0 0 10px 0px;
padding:0;
}


Many thanks!


Shaun

Snookerman
01-22-2009, 04:54 PM
I can't really see any ads on your page but I can give you some tips that might be helpful. If a value is 0 (zero) just write 0 without the unit:


.rightads {
float: left;
position: relative;
text-align: center;
width: 150px;
margin-left: 0;
margin-bottom: 10px;
margin-top: -87px;
padding: 0;
}
.rightads_container {
padding-left: 0;
padding-top: 10px;
}
.rightads_ad {
margin: 0 0 10px 0;
padding: 0;
}

Also, it's good practice not use padding on an element that has a specified width since IE sometimes has problems with that. Instead you could wrap the content inside that element in another container and give that container a margin.

Good luck!

Moshambi
01-22-2009, 06:03 PM
If a value is 0 (zero) just write 0 without the unit:

Is this really necessary? Does it actually create problems if you add 'px' on the end of the 0?

Because I do the same thing and was just wondering if it actually makes a difference....thanks!

Snookerman
01-22-2009, 06:56 PM
Is this really necessary? Does it actually create problems if you add 'px' on the end of the 0?

Because I do the same thing and was just wondering if it actually makes a difference....thanks!
Actually I'm not really sure about this one. I know for a fact that the unit is not necessary for zero values since 0px = 0em = 0% = etc.. and I've also noticed that many programs remove the units from zero values (e.g. Firebug, W3 CSS validator, several editors) so I just assumed that was considered good practice. Plus, it will save some bytes (http://www.designdetector.com/2006/06/ten-common-css-mistakes.php).

This optimization site seems to be very serious about it although no explanation is given just yet:
http://www.negabytes.com/efficiency/3.3.6.php (http://www.negabytes.com/efficiency/3.3.6.php)

Moshambi
01-22-2009, 07:16 PM
I just assumed that was considered good practice.

See that's what I figured too, that's why I have always done the same as you have and put the unit on the number EVEN if it is 0. I will have to check back on that site because I'm interested to see the reasoning behind it...all I can think is the effect on file size? but it doesn't seem like it would make that much of a difference because it would add such a minute value to the size....