Solved

Bottom margin/padding/spacing doubled in IE7

Posted on 2008-10-15
18
1,390 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 24

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 24

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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 24

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 24

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

705 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

20 Experts available now in Live!

Get 1:1 Help Now