Margin different in IE and Firefox when using float

This is a discussion on "Margin different in IE and Firefox when using float" within the Web Page Design section. This forum, and the thread "Margin different in IE and Firefox when using float are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Apr 17th, 2007, 10:35
Up'n'Coming Member
Join Date: Jul 2005
Location: uk
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Talking Margin different in IE and Firefox when using float

I am trying to get a set of images with a rollover to sit in a container div with a margin of 20px on the right of each block. The problem is when I add float left the margin adds itself to the container block in IE but not FF. Any help, yes please! Note the container should be 400px and is being pushed out to 420px!!!

The css is:
Code: Select all
body {
 font-family: Verdana, Arial, Helvetica, sans-serif;
 color: #000000;
 background-color: #FFFFFF;
}
#thumbcontainer {
 height: 200px;
 background-color: #999999;
 width: 400px;
}
#ruller {
 background-color: #FFCC66;
 width: 400px;
}
/* The position has to be absolute or the margin doubles in IE  */
#thumbcontainer a {
 background-color: #FFFFFF;
 border: 1px none #CCCCCC;
 display: block;
 height: 94px;
 width: 180px;
 text-align: center;
 margin: 0px 20px 20px 0px;
 padding-top: 10px;
 padding-bottom: 10px;
 float: left;
}
#thumbcontainer a:hover {
 background-color: #CCCCCC;
 border: 1px none #CCCCCC;
}
Html is:
HTML: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>div gallery 02</title>
<link href="css/global.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="thumbcontainer"><a href="#"><img src="../shared_images/piglets_02.jpg" alt="" width="94" height="94" border="0" /></a><a href="#"><img src="../shared_images/piglets_02.jpg" alt="" width="94" height="94" border="0" /></a></div>
<div id="ruller">400 px</div>
</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Apr 17th, 2007, 11:47
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Margin different in IE and Firefox when using float

This is a screenshot of your code in FF. Is the wrong?

Last edited by Lchad; Jun 17th, 2007 at 11:22.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Apr 17th, 2007, 12:05
Up'n'Coming Member
Join Date: Jul 2005
Location: uk
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Margin different in IE and Firefox when using float

Quote:
Originally Posted by Lchad View Post
This is a screenshot of your code in FF. Is the wrong?
No thats what I want its what IE does to it
Thanks for the interest - I still feel a bit stupid when it comes to css layouts! And the difference in IE and FF frustrates me greatly!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Apr 17th, 2007, 12:18
Elite Veteran
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Margin different in IE and Firefox when using float

It's exactly the same in IE7. So is IE 6 the cause of the problem?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Apr 17th, 2007, 13:28
Up'n'Coming Member
Join Date: Jul 2005
Location: uk
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Margin different in IE and Firefox when using float

Yes I am using IE6
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Apr 17th, 2007, 13:47
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Margin different in IE and Firefox when using float

Change your width in #thumbcontainer a { ... } to width: 170px;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Apr 17th, 2007, 14:21
Up'n'Coming Member
Join Date: Jul 2005
Location: uk
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Re: Margin different in IE and Firefox when using float

Quote:
Originally Posted by karinne View Post
Change your width in #thumbcontainer a { ... } to width: 170px;
Thanks Karinne but I want the rollover space to be 180px just dont want the extra margin on the container that appears (in IE6) when you add float. I have the thing working inside a table but I am trying to be progressive and use divs where possible.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Apr 17th, 2007, 14:32
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Margin different in IE and Firefox when using float

try this

Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>div gallery 02</title>
<style type="text/css">
body {
 font-family: Verdana, Arial, Helvetica, sans-serif;
 color: #000;
 background-color: #fff;
}
#thumbcontainer {
 height: 200px;
 background-color: #999;
 width: 400px;
}
#ruller {
 background-color: #fc6;
 width: 400px;
}
/* The position has to be absolute or the margin doubles in IE  */
#thumbcontainer a {
 background-color: #fff;
 display: block;
 height: 94px;
 width: 180px;
 text-align: center;
 margin: 0 20px 20px 0;
 padding: 10px 0;
 float: left;
}

#thumbcontainer a.last {
 margin-right: 0;
}

#thumbcontainer a:hover {
 background-color: #ccc;
}</style>

</head>
<body>
<div id="thumbcontainer"><a href="#"><img src="../shared_images/piglets_02.jpg" alt="" width="94" height="94" border="0" /></a> <a href="#" class="last"><img src="../shared_images/piglets_02.jpg" alt="" width="94" height="94" border="0" /></a></div>
<div id="ruller">400 px</div>
</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Apr 17th, 2007, 14:55
Up'n'Coming Member
Join Date: Jul 2005
Location: uk
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Re: Margin different in IE and Firefox when using float

Thats fantastic Karinne ta very much. Did not know you could give a class to a link like that. It works in IE6 and FF !!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
float, margin

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange margin display in firefox only hhelen Web Page Design 1 Apr 28th, 2008 15:36
Float problem with Firefox Emzi Web Page Design 10 Apr 4th, 2008 12:02
Float: Left with firefox magnetica Web Page Design 2 Aug 24th, 2007 16:55
Margin area not tranparent in Firefox (works fine in IE6) Breazile Web Page Design 2 Nov 6th, 2005 17:09
site ok in Firefox, not in IE : float problem?? bbbobo Web Page Design 1 Sep 30th, 2005 08:16


All times are GMT. The time now is 01:36.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42