Webforumz's RSS FeedRSS Webforumz RegistrationRegister Contact Webforumz StaffContact

div after img creates unwanted spacing only in firefox

This is a discussion on "div after img creates unwanted spacing only in firefox" within the Web Page Design section. This forum, and the thread "div after img creates unwanted spacing only in firefox 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 Aug 28th, 2008, 23:13
New Member
Join Date: Aug 2008
Location: Cupertino, CA
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
div after img creates unwanted spacing only in firefox

15 minutes into coding, I find this problem that's so ridiculously simple yet unfix-able with my current knowledge.

There's a spacing between the images for my nav buttons and the new div I made for my content.
The problem only appears in firefox.
I'll appreciate any help, even a hack would work.

Edit: Opera also has the spacing. Maybe it's IE doing something wrong. Still looking for a fix to it though.
Edit again: I found a temporary fix by making the margins into negatives. But then that screws up IE. This is really starting to annoy me. I now see the importance of the Acid Tests.



Html
Code: Select all
<body>
<div id="center">

<div id="navbar">
     *images for navigation*
</div>

<div id="content">
    <div id="iframe">
    *content*
    </div>
</div>

</div>

</body>
CSS Code
Code: Select all
body {
    margin:0px;
    padding:0px;
    background-color:#333333;
    }
    
/*styles*/
#center {
    margin:150px auto;
    width:780px;
    height: 500px;
    }
    
#navbar {
    width:780px;
    height: 90px;
    }
    
#content {
    background-image: url(../images/cover_r4_c1.png);
    width: 780px;
    height: 410px;
    }

Last edited by MeruFM; Aug 28th, 2008 at 23:39.
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 Aug 29th, 2008, 00:09
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,429
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: div after img creates unwanted spacing only in firefox

On the #navbar and #content add:

margin: 0;
padding: 0;
__________________
Yours is the Earth and everything that's in it
And - which is more - you'll be a Man my son!
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
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 Aug 29th, 2008, 00:17
New Member
Join Date: Aug 2008
Location: Cupertino, CA
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: div after img creates unwanted spacing only in firefox

Quote:
Originally Posted by Jack Franklin View Post
On the #navbar and #content add:

margin: 0;
padding: 0;
Thanks for trying but it didn't help.

I actually add * {padding: 0; margin: 0; border: 0;} to the top of all css as a habit.

Edit:
Fixed it.
Added "float: left;" to

#content {}

I don't get why but it worked. I guess it's just a requirement to remove margins from div tags.

Last edited by MeruFM; Aug 29th, 2008 at 04:17. Reason: Finished
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 Aug 29th, 2008, 16:21
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
Re: div after img creates unwanted spacing only in firefox

floating just takes the element out of the normal document flow. It does not directly affect margins or padding.
__________________

Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
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

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
CSS 'clear float' creates too much gap cdarnbor Web Page Design 1 Jul 7th, 2008 01:44
IE Browser Creates Problem sakibonline Web Page Design 1 Aug 8th, 2007 13:57
Extra line spacing in Firefox vs IE bgoo Web Page Design 6 Apr 16th, 2007 01:17
Page creates horizontal scroll bar in IE leebridgewater Web Page Design 1 Mar 5th, 2006 10:23
Firefox creates huge gap? shifts down. ElmerFud3 Web Page Design 1 Dec 14th, 2005 15:41


All times are GMT. The time now is 19:17.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8