Click to See Complete Forum and Search --> : margins


Beach Bum
12-06-2002, 09:06 PM
a simple question, but i bet the answer is not.

when doing a page layout and moving an image (or anything else - i have the same result with lists) back up on the page i am using:

margin: -100px 0 0 0;

in NS7 it moves up 100px.

in IE6 it moves up 97px.

i have found that IE is consistently "off" by 3px from what i tell it to do every time i use a negative margin. it goes up 3px less than it should.

any clues as to why? when you are working at the px level you would think things would be precise.

Zach Elfers
12-06-2002, 10:28 PM
How do you know the exact pixel ammounts? Do you like get a magnifying glass or something?

Stefan
12-06-2002, 10:38 PM
Originally posted by Beach Bum
i have found that IE is consistently "off" by 3px from what i tell it to do every time i use a negative margin. it goes up 3px less than it should.

any clues as to why?

Becuse IE/Win is a piece of crap and the programmers that coded it can't count to 100. :D

The workaround is to use another bug in IE to feed it an incorrect value of -103px which will move it the correct -100px.

This thread shows a number of various parsing bug explotaitions for IE as well as other browsers:
http://forums.webdeveloper.com/showthread.php?s=&threadid=356

Zach Elfers
12-06-2002, 10:43 PM
IE/Windows is not crap. IE is better than all the other browsers and if it isn't then what is then????

Stefan
12-06-2002, 10:50 PM
Originally posted by Zach Elfers
IE/Windows is not crap. IE is better than all the other browsers and if it isn't then what is then????

Well for starters neighter Gecko browsers nor Opera thinks 100px = 97px... only IE manages that...
Learn to code webpages using theoretically correct code and you will see just how often IE manages to botch up even the simplest things.

Zach Elfers
12-06-2002, 10:55 PM
Sooo....

Stefan
12-06-2002, 11:02 PM
Originally posted by Zach Elfers
Sooo....

What, isn't the connection obvious enough for you?

Massivly buggy software = crappy

Zach Elfers
12-06-2002, 11:06 PM
You're not mentioning all the problems with other browsers. IE displays things right even if they have buggs. I don't care.

Stefan
12-06-2002, 11:13 PM
Originally posted by Zach Elfers
You're not mentioning all the problems with other browsers. IE displays things right even if they have buggs. I don't care.

How can IE display something "right" if it's incorrect?
Obviously IE can't even display something right that _is_ correct...

If you code you pages for NS 4 only everything will look "right" on it too...

The point here is that if the code you have does NOT display as it's theoretically supposed to, then that is a bug in the browser NOT a good feature as you seem to believe.

And as for "not mentioning all the problems with other browsers", all software has bugs, there is no such thing as a perfect program. It's just that IE got so many more bugs then other browsers it's not even funny...

Charles
12-07-2002, 05:38 AM
Zach,

If the best browser is the browser that is most tollerant of errors, then Lynx (http://lynx.browser.org/) is a far better browser than MSIE.

Beach Bum
12-07-2002, 08:35 AM
didn't mean to start a browser war discussion.

i was just wondering if anyone had encountered this and found a solution.

obviously i can fudge the number, but then it makes the NS7 view off by the same amount the other way.

Stefan
12-07-2002, 09:10 AM
Originally posted by Beach Bum
[B]didn't mean to start a browser war discussion.

i was just wondering if anyone had encountered this and found a solution.


Yes, and I linked to the solution in the first post, but here it is again for clarity.


div.myDiv{
margin: -103px 0 0 0; /* Used by IE5/win & IE5.5/win */
voice-family: "\"}\""; voice-family:inherit;
margin: -103px 0 0 0; /* Used by IE6/win */
}

html>body div.myDiv {margin: -100px 0 0 0;}


In this case I have assumed that IE 5.x also is exactly 3px off. That is not nessecarily the case, so you might need to tweak the value of the first occurance of margin.

Beach Bum
12-07-2002, 04:44 PM
Stefan -

thanks for the solution. now i need to find where the problem starts.

if i run one margin test by itself everything is OK. it appears that IE gets confused when you make a complex page with a lot of bouncing around (as I am doing). i may just give up and accept the fact that there may be a few px difference in some cases.

but i am sure that NS7 is doing it right and IE6 cannot count.