Margin positioning question

User 107145 Photo


Registered User
88 posts

I created a page with two columns on the top followed by text going across the entire page. In IE6 I am able to add a top margin to the bottom text to separate it from the two columns above. In FF it does not work and I can't figure out why.

Here is the page url .... http://perau.com/top2nav020509.html

I left my layout borders on the page to help figure out what is going on. I think its something simple but I can't seem to find it.

Thanks for your help
pk
... so much to learn!!
User 355448 Photo


Ambassador
3,144 posts

pk,

I suspect that IE does what you want because IE doesn't follow all the rules.

As an example, an ID should only be used one time. This may not fix your problem, but change all of your <h3 id="h3text"> entries to <h3 class="h3text"> and change your style #h3text to be .h3text. The # is for use with a single ID and the period (or full stop) is used for classes as often as you want to use it.

Give that a test, and see if it makes a difference.
User 107145 Photo


Registered User
88 posts

Thanks Bill. I made the changes but it did not effect the margin.

Thanks
pk
... so much to learn!!
User 355448 Photo


Ambassador
3,144 posts

pk,

Just another guess-- Your left and right columns do not have a height entry in the styling. Try entering a height:auto; which allows the browser to calculate the height of your columns. I would put the height in both left and right style sections.
User 107145 Photo


Registered User
88 posts

Thanks Bill. Someone suggested putting in .... <div style="clear:both"></div> before the <div id="bottext"> in the code. That seemed to work. My question is why did this work and not the .... {clear:both; } I had in the CSS.


Thanks
pk
... so much to learn!!
User 463058 Photo


Ambassador
1,086 posts

pk wrote:
My question is why did this work and not the .... {clear:both; } I had in the CSS.


This is do to IE's handling (or not) of Collapsing Margins:

http://reference.sitepoint.com/css/collapsingmargins

http://www.andybudd.com/archives/2003/1 … for_error/

You can also try and see how using padding-top would have worked differently than margin-top.
User 107145 Photo


Registered User
88 posts

Thanks Cary. I need to read the articles a few more times so I can get a better handle on what they are saying and maybe retain that info!

Thanks
pk
... so much to learn!!
User 355448 Photo


Ambassador
3,144 posts

Cary,

One of the things I really like about these forums is the knowledge that is freely shared. I don't think I have ever heard of collapsing margins until today. Those links you provided have been bookmarked for future reference.

I like to learn something new every day. Today, I learned something on the first post I read.

Thanks for this information.
User 463058 Photo


Ambassador
1,086 posts

You're welcome. I only knew about it because of Andy Budd's book "CSS Mastery". The second link is from his site.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.