Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 176429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:52:33+00:00 2026-05-11T13:52:33+00:00

According to the CSS 2.1 standard, the vertical margins of floating elements should not

  • 0

According to the CSS 2.1 standard, the vertical margins of floating elements should not collapse with any adjacent elements.

See: http://www.w3.org/TR/CSS21/box.html#collapsing-margins

But actually this is not what happens in all browsers (FF, Safari, Opera and Chrome) except IE6 (didn’t try with IE7 or IE8 though). Here’s the code:

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> <html xmlns='http://www.w3.org/1999/xhtml' > <head> <title></title> <meta http-equiv='Content-Type' content='text/html;charset=iso-8859-1' /> </head> <body> <div style='margin-bottom:10px;'>HEADER</div> <div style='float:left;width:100%;margin:10px 0px;'>Floating div</div> <div style='margin-top:10px;'>FOOTER</div> </body> </html> 

Adding clear:both; to the footer div didn’t make any difference.

I’m no expert in CSS so please correct me if my understanding is wrong

Edit:
Obviously my question caused some confusion. The code above is just for demonstrating the behavior I’m referring to, it’s not a real problem that I’m trying to find a solution to.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:52:34+00:00Added an answer on May 11, 2026 at 1:52 pm

    In neither IE6 nor the standards browsers are the float’s margins collapsing with its siblings. This is correct as per the quoted standard.

    The difference in renderings is caused by IE6’s interpretation of which margins flow together. (If you give each div a background colour it makes it easier to see what is happening here.)

    Two or more adjoining vertical margins of block boxes in the normal flow collapse

    With the normal flow defined thus:

    Since a float is not in the flow, non-positioned block boxes created before and after the float box flow vertically as if the float didn’t exist.

    That is, they flow together and have adjoining vertical margins which may collapse. IE6 (and IE7 in Quirks Mode) gets this wrong, and thinks that the float breaks up the flow, causing no collapsing to occur.

    With the general confusion surrounding vertical margins and collapsing, compounded by the still-extant browser bugs, I’d recommend avoiding vertical margins and using padding instead wherever possible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I happened to use the below CSS hack for WebKit-based browsers, according to http://www.webmonkey.com/2010/02/browser-specific_css_hacks/
According to CSS principles when we want to implement reusability of styles we should
According to the W3 CSS spec, something like: input[type~=text password] should select input fields
According to bootstrap-responsive.css file,the media query @media (max-width: 767px) is repeated meaning it occurs
I found a tutorial on css tricks to make a simple accordion. http://css-tricks.com/snippets/jquery/simple-jquery-accordion/ I
According to the C++11 standard, is the following program well-formed and portable C++? int
Good day! I want to add and remove CSS files according to the size
I am trying to make CSS drop down menu (no javascript involved). According to
I am using a compression library for my js and css files. However according
According to the W3C Recommendation for the CSS background shorthand , the values are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.