Solved

Bottom margin/padding/spacing doubled in IE7

Posted on 2008-10-15
18
1,400 Views
Last Modified: 2013-12-08
I have a page setup that displays correctly in Firefox and Safari, but in IE7, the browser is adding extra padding/margin/spacing at the bottom of the content DIV.

The markup resembles:

<div id="page">
  <div id="header">
  </div>
  <div id="content">
     <div id="leftcol">
     <div id="rightcol">
  </div>
  <div id="footer">
  </div>
</div>

#leftcol and #right col are floated left, and #footer contains clear:both. For some reason in IE extra space is added at the bottom of #content right before #footer.

I'm sure there is a simple solution, but I have yet to find it in my searches. Thanks!
0
Comment
Question by:jimsteele01
  • 5
  • 5
  • 4
  • +1
18 Comments
 

Author Comment

by:jimsteele01
ID: 22725949
The URL for the site in question is http://67.199.102.104 

Not sure if it was included in my question post.

Thanks!
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22730775
I think it is this:

p {
    padding: 0 0 20px 0;
}

where you may want

#leftcol p {
    padding: 0;
}
#rightcol p {
    padding: 0;
}


too
0
 

Author Comment

by:jimsteele01
ID: 22730879
Thanks for your response! Actually, I do want each p element in leftcol and rightcol to have a bottom padding to separate each p block. the bottommost p element should provide the spacing between the content area and the footer (where the double lines start). If I remove the padding, then it throws off the layout in Safari and Firefox.


0
 
LVL 42

Expert Comment

by:David S.
ID: 22736272
Odd.  Try removing the bottom margin from #rotatehome and giving a top margin to both #leftcol and #rightcol instead.
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 22737093
from looking at the page source my first reaction is "of course this will add space"
I'm more familiar with ie than with other browsers.
I develop in ie then modify where needed to accomodate other browsers.

The page is doing exactly as what I would expect.
To remove space you need to style and or layout differently.
like for example you have 2 closing div tags </div> and 1 closing P tag </p> before the footer starts.
By default P tags create space after them and so do div's.
NOTE: I did not look at your stylesheet.

You can try just adding to a certain element margin-top:0px or padding-top:0px to an element
this calls for experimenting

good luck ...
0
 

Author Comment

by:jimsteele01
ID: 22740468
Thanks again for the input, but this solution didn't help either. I removed all of the spacing between the closing tags and unfortunately nothing changed. Since it displays fine in FF and Safari, I was hoping that it was one of those situations where IE doubles the padding, but none of the IE CSS hacks are working yet.
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 22740605
just re-read my response
forgot to mention that these tags (div & p) are block tags
by default a block tag is like putting 2 <br />'s  after an inline tag
you can try (in your style) display:inline;
not sure if need to do this with just the affected div's or the p also

Q: when you are having this trouble - why are you using div's?
it seems that your situation could be much better handled by tables & tr - td
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 42

Expert Comment

by:David S.
ID: 22743006
@Jim: No comment on my reply?


@dgrafx:

I suggest you learn how semantics apply to [X]HTML: http://www.dynamicsitesolutions.com/html/semantic-markup/
http://dev.opera.com/articles/view/semantic-html-and-search-engine-optimiza/

*sigh* There's more I'd like to say to you, but since you probably wouldn't listen anyway, I'm going to stop here.
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 22743051
great - now I'm getting advice from amateurs ...
0
 
LVL 42

Expert Comment

by:David S.
ID: 22743090
LOL

That's really ironic. From my point of view you're the amateur -- mainly because you don't accept that IE is displaying it incorrectly.

So why do you think I'm an amateur? I really would like to know. Was it because my first reply was so short?
0
 

Author Comment

by:jimsteele01
ID: 22743128
Thanks for the responses.

@dgrafx
You are right about the way IE is rendering block elements. What I ended up doing to solve this problem (although I didn't want to necessarily do this) was to add conditional CSS links for IE specific browsers. That way, I could update the CSS issues in IE without affecting other browsers.

@Kravimir
Sorry, I missed your earlier reply. Because I am using #leftcol and #rightcol in other pages where there's no other div above them, I didn't want to put a top margin on those because it would cause unwanted space above those 2 elements. The conditional CSS, although not ideal, solved the issue. Hopefully IE8 will adhere to standards, so this won't be an issue in the future.



0
 
LVL 42

Expert Comment

by:David S.
ID: 22743237
@Jim:  Ah. Yeah, given that additional constraint, I'd probably do what you did.

And yes, IE8 will be much more standards compliant than IE7. The second public beta version shows a great deal of improvement already. If you want more information on it, just ask.
0
 

Author Comment

by:jimsteele01
ID: 22743324
@Kravimir
That's great to hear. I know I'm not the only one frustrated with having to hack the CSS to make it work with IE. Looking forward to the new release!
0
 
LVL 25

Accepted Solution

by:
dgrafx earned 250 total points
ID: 22743492
>>Jim
Back in the day I used to kick and scream about browsers rendering pages differently.
Then I decided that since I cannot do anything about it - it was pointless to rant about standards - especially since MS rules the world.
So my plan was simple
most people use IE - so I use IE
I then simply need to modify a few things for other browsers

When you need to get the project done and get paid - there usually is not any time to rant about standards.
Don't get me wrong - if I could do anything about these issues I would.
I am not by any stretch saying "the heck with standards".

good luck with your project
if what I posted helped then I'm glad
0
 
LVL 42

Assisted Solution

by:David S.
David S. earned 250 total points
ID: 22745025
@dgrafx

Ah. You didn't just always use IE as your primary test browser.

For me I find it easier to code to standards and then fix things in IE. It helps that by having experience I know a lot of what works and what doesn't, so I can avoid things that are particularly difficult to get IE to cooperate on.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Button Css BootStrap 2 35
Centering a nested div 16 58
Content Filtering by Search Term with a Smoothwall Firewall 1 88
Host asp.net pages 5 25
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now