positioning with IE & Mozilla

  • futurebuzz
  • Student
  • Student
  • User avatar
  • Joined: 13 Apr 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:

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: 28 May 2003
  • Posts: 21845
  • Loc: Pittsburgh PA
  • Status: Online

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)
"The web is a dominatrix. Every where I turn, I see little buttons ordering me to Submit."
Boasting Rights Sports Forum || Nuclear Services - www.alaron-nuclear.com

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.

-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...

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: 28 May 2003
  • Posts: 21845
  • Loc: Pittsburgh PA
  • Status: Online

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.
"The web is a dominatrix. Every where I turn, I see little buttons ordering me to Submit."
Boasting Rights Sports Forum || Nuclear Services - www.alaron-nuclear.com
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: 24 Mar 2004
  • Posts: 1858
  • 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:

div{
    padding:0px;
    border-style:solid;
}
div p{
    margin:10px;
}


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.
  • futurebuzz
  • Student
  • Student
  • User avatar
  • Joined: 13 Apr 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: 14 May 2004
  • Posts: 1
  • Loc: Prague
  • Status: Offline

Post May 14th, 2004, 10:35 am

digitalMedia wrote:

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: 24 Mar 2004
  • Posts: 1858
  • 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:

border:5px;
padding:10px;
width:470px !important; /*moz width*/
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
  • blankrags
  • Born
  • Born
  • User avatar
  • Joined: 29 Jan 2007
  • Posts: 1
  • Status: Offline

Post January 29th, 2007, 11:42 am

WOW! Such a simple solution to such an annoying problem. Thanks!

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
Online Marketing Service Provider-> http://www.epurplemedia.co.uk
  • Megalith
  • Born
  • Born
  • No Avatar
  • Joined: 13 Jul 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;}?

Post July 13th, 2008, 11:33 pm

I don't understand what you're saying ... ?
RewriteEngine On

RewriteRule ^(awesome|excellent|extraordinary)$ RT
  • Megalith
  • Born
  • Born
  • No Avatar
  • Joined: 13 Jul 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.

Post July 13th, 2008, 11:42 pm

What do you want to accomplish by "implementing" that code?
RewriteEngine On

RewriteRule ^(awesome|excellent|extraordinary)$ RT
  • Megalith
  • Born
  • Born
  • No Avatar
  • Joined: 13 Jul 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
  • Moderator: Moderator Team
  • Users browsing this forum: UPSGuy and 63 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
 
 

© Unmelted Enterprises 1998-2009. Driven by phpBB © 2001-2009 phpBB Group.