positioning with IE & Mozilla

  • futurebuzz
  • Student
  • Student
  • User avatar
  • Joined: Apr 13, 2004
  • Posts: 75
  • Loc: Birmingham England
  • Status: Offline

Post April 26th, 2004, 2:36 pm

Hello,

Can anyone tell me if i can position a table or whatever in IE but in Mozilla make it a few px different all in the same code??

Like:

Code: [ Select ]
position: absolute; top:50px; left:100px; width:50; height: 50px; -moz-position: absolute; top:55px; left:105px; width:55; height: 55px;
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 26th, 2004, 2:36 pm

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Post April 26th, 2004, 2:58 pm

Is this because, your borders or margins look different in Moz? It's been awhile, but I'm pretty sure the pixel variation has something to do with the difference in how Mozilla parses border and or margin values. I'm trying to remember, but I'm almost certain there was a conversation about this somewhere else in this forum.

To answer your specific question, I don't think you can do it like you are asking. You may be able to do it with a custom javascript for browser sniffing and if it's IE it uses one stylesheet and if Moz another. But if I'm reading into your question correctly, you may be able to play with either margin or border settings to solve your problem. (more than likely margin)
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Joined: Dec 29, 2003
  • Posts: 5169
  • Loc: SC-USA
  • Status: Offline

Post April 26th, 2004, 4:01 pm

If ATNO is correct - the difference is the CSS box model. If you're not familiar with the box model take a look at this link...

http://www.w3.org/TR/REC-CSS2/box.html

IE measures the width of an object from border to border, where Mozilla measures the width in terms of the content.

You can force Mozilla to measure it the same way by adding these to your style definitions.

Code: [ Select ]
-moz-box-sizing:border-box;box-sizing:border-box;


I'm more comfortable in measuring things from border to border, so all of my HTML/XHMTL templates have this definition...

Code: [ Select ]
DIV{-moz-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;}


//Learned it at Ozzu! :D
- dM
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Post April 26th, 2004, 4:43 pm

Thanks dM. I'm sure that's the answer to the problem. I was just too busy earlier to look for it. But that looks spot on with what I was thinking.
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Mar 24, 2004
  • Posts: 1855
  • Loc: Uk
  • Status: Offline

Post April 27th, 2004, 1:05 am

I tend not to use padding, eg if I want a 10px padding in a div:

Code: [ Select ]
div{
  padding:0px;
  border-style:solid;
}
div p{
  margin:10px;
}
  1. div{
  2.   padding:0px;
  3.   border-style:solid;
  4. }
  5. div p{
  6.   margin:10px;
  7. }


although to be fair you have to mess around with the vertical margins for p to get the line space right....

That just seems to me to be an easier way to get the compatibility than messing around with browser-specific code.

I also start off by making the body have 0px margin and padding.
CSS website design tutorials
  • futurebuzz
  • Student
  • Student
  • User avatar
  • Joined: Apr 13, 2004
  • Posts: 75
  • Loc: Birmingham England
  • Status: Offline

Post April 27th, 2004, 10:01 am

Fantastic!!!

Thanks guys, it worked.
  • nxt
  • Born
  • Born
  • No Avatar
  • Joined: May 14, 2004
  • Posts: 1
  • Loc: Prague
  • Status: Offline

Post May 14th, 2004, 10:35 am

digitalMedia wrote:

Code: [ Select ]
DIV{-moz-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;}




Brilliant - I've been dealing with this so long and it was such pain in the ... (you know - the thing some of us think with) ....suddenly, all my problems are solved! Thanx!
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Mar 24, 2004
  • Posts: 1855
  • Loc: Uk
  • Status: Offline

Post May 14th, 2004, 10:42 am

Just in case anyone is interested, the simplest valid way of getting mozilla and IE to give the same width, even with large padding and borders:

Code: [ Select ]
border:5px;
padding:10px;
width:470px !important; /*moz width*/
width:500px; /*IE width*/
  1. border:5px;
  2. padding:10px;
  3. width:470px !important; /*moz width*/
  4. width:500px; /*IE width*/


which works as much as I have tested even in opera. Just make sure you calculate the mozilla width properly and use the !important
CSS website design tutorials
  • blankrags
  • Born
  • Born
  • User avatar
  • Joined: Jan 29, 2007
  • Posts: 1
  • Status: Offline

Post January 29th, 2007, 11:42 am

WOW! Such a simple solution to such an annoying problem. Thanks!
  • kailyn_morgan
  • Novice
  • Novice
  • No Avatar
  • Joined: Jan 23, 2007
  • Posts: 22
  • Loc: london
  • Status: Offline

Post February 1st, 2007, 2:59 am

oh... i was abt to give the same solutiona s the above only.. :)

I think the best is to use DIV for the same and also the codes given above are just fyn... do go ahead with them and I am sure you wont find any problem with them....


Cheers,
Kailyn Morgan
http://www.epurplemedia.co.uk
  • Megalith
  • Born
  • Born
  • No Avatar
  • Joined: Jul 13, 2008
  • Posts: 3
  • Status: Offline

Post July 13th, 2008, 6:55 pm

Sorry for bumping such an old thread---I'm a total noob. How and where do I integrate DIV{-moz-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;}?
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post July 13th, 2008, 11:33 pm

I don't understand what you're saying ... ?
Let's leave all our *plum* where it is and go live in the jungle ...
  • Megalith
  • Born
  • Born
  • No Avatar
  • Joined: Jul 13, 2008
  • Posts: 3
  • Status: Offline

Post July 13th, 2008, 11:39 pm

I'm asking, how exactly (where) do I integrate this code?

After some searching, I've also found some sites stating that you can have IE and Firefox share the same box model by specifying a particular DOCTYPE.

Didn't seem to work for me, though.
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post July 13th, 2008, 11:42 pm

What do you want to accomplish by "implementing" that code?
Let's leave all our *plum* where it is and go live in the jungle ...
  • Megalith
  • Born
  • Born
  • No Avatar
  • Joined: Jul 13, 2008
  • Posts: 3
  • Status: Offline

Post July 14th, 2008, 4:47 pm

I want Firefox and IE to share the same box model.

I'm currently coding a newsletter, and Firefox adds around 5px of space.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post July 14th, 2008, 4:47 pm

Post Information

  • Total Posts in this topic: 20 posts
  • Users browsing this forum: No registered users and 110 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.