Computing.Net > Forums > Web Development > Random spacing between DIVs in Firefox

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Random spacing between DIVs in Firefox

Reply to Message Icon

Name: anifstudios
Date: July 1, 2009 at 19:09:43 Pacific
OS: Windows Vista
Subcategory: HTML
Comment:

Hi,

I need help with what seems so basic, but yet I cannot figure out what the problem is. First off, here is a link to the ZIP of the html/css/img files.
HTML FILES

Here is my problem. I have 3 DIVs sitting inside of a main DIV. These 3 DIVs are supposed to be sitting stacked on top of eachother flush.

When viewed in IE and Firefox as is, you can see there is spacing between the DIVs in Firefox, but IE displays them the way I want them to be.

Here is the weirdest part, now try uncommenting all the 4 Border attributes in the CSS file, save and preview the html. This time around, they are being displayed properly in both Firefox and IE. The problem is I obviously dont want the border. The second problem is what is causing the spacing in firefox, this makes no sense.

Someone help me pls.



Sponsored Link
Ads by Google

Response Number 1
Name: Laler
Date: July 2, 2009 at 03:47:31 Pacific
Reply:

It's the H3. Zero their margin and problem begone.

eg: h3 { margin: 0; }

Almost all browsers will apply some margin to some tags such as heading tags, and paragraph.

---
Fubar


0

Response Number 2
Name: Laler
Date: July 2, 2009 at 04:03:01 Pacific
Reply:

and btw afaik "none" is not a valid background-color value. You should use "transparent" or just skip the declaration.

---
Fubar


0

Response Number 3
Name: anifstudios
Date: July 2, 2009 at 06:59:32 Pacific
Reply:

OMG.....THANK YOU!!! I'm about to freak out. I have been trying to debug this for almost 1 week. I actually changed layouts cos I was having problems with my original layout....now only to find out it is the damn H3 tags. I really appreciate the help and quick response.


0

Response Number 4
Name: anifstudios
Date: July 2, 2009 at 07:02:32 Pacific
Reply:

While I'm at it if you don't mind, do you have any suggestions how to center the main DIV horizontally on the screen, so the page always sits centered no matter the resolution. I google'd various methods and tried them with some minor problems, but maybe the H3 tags where screwing thing up all along.


0

Response Number 5
Name: Laler
Date: July 2, 2009 at 07:14:17 Pacific
Reply:

^ to achieve that I'll wrap everything in a main wrapper, apply a width (if it's fixed) and left-right auto margin.

#wrapper { width: 760px; margin: 0 auto; }


<body>
<div id="wrapper">

content here

</div>
</body>


--


I also got used to this:

body { margin: 0; padding: 0; }

and starts the "real layout" in a div tag inside the body (the #wrapper div above for example).

I have a feeling that directly modifying the body's margin/padding/width is kind of "unsafe"... But maybe it's just me. :D

---
Fubar


0

Related Posts

See More



Response Number 6
Name: anifstudios
Date: July 2, 2009 at 07:18:30 Pacific
Reply:

Thanks a lot...it is amazing how 1 little thing can screw up an entire layout!!


0

Sponsored Link
Ads by Google
Reply to Message Icon





Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Random spacing between DIVs in Firefox

How to give fixed length of DIV in Firefox. www.computing.net/answers/webdevel/how-to-give-fixed-length-of-div-in-firefox/4180.html

drop down wont work in firefox www.computing.net/answers/webdevel/drop-down-wont-work-in-firefox/3581.html

Blank Page in Firefox www.computing.net/answers/webdevel/blank-page-in-firefox/1984.html