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 8917263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:26:33+00:00 2026-06-15T05:26:33+00:00

Possible Duplicate: Firefox body margin bug? I have previously gotten stuck with vertical padding

  • 0

Possible Duplicate:
Firefox body margin bug?

I have previously gotten stuck with vertical padding issues and thought I understood it all when I resolved it. But again, I am stuck…

I am playing around with some existing themes to see how they work and have come to an issue where there is a major inconsistency between Firefox 17 and Google Chrome 23, both on Win7.

I have narrowed down the code to the small snippet below. (I inlined some styles to save space).

<!DOCTYPE html >
<head>
    <style type="text/css">
        .container:after{
            content: "\0020";
            display: block;
            clear: both;
        }
    </style>
</head>
<body>
  <div class="container" style="background:#0f0;">
    <div style="float: left;" >Words</div>
  </div>
  <div style="background:#f00; margin-top: 100px;">Words</div>
</body>
</html>

If I try the above in Google Chrome (or in IE 8), it behaves as I would expect. The first top-level div is at the top of the page and the second top-level div is below it, spaced due to its margin-top style.

However, when I try it in Firefox, the first div has now been spaced down the page. This is in direct relation to the 2nd divs margin-top parameter. Increasing the value will increase the top margin spacing for the entire <body> element, even though its style has not been altered.

Now I understand the :after and content: "\0020" parts are part of a clearfix, and I admit to not being 100% clued up on clearfixes and floats yet, but I am perturbed that the above code would behave so differently in 2 major browsers.

Can someone enlighten me as to what I am missing here and why the behaviour is different?

Edit: As pointed out by BoltClock, this looks to be a duplicate of a long standing (Since FF2) FireFox bug –

  • 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. Editorial Team
    Editorial Team
    2026-06-15T05:26:35+00:00Added an answer on June 15, 2026 at 5:26 am

    I can’t really explain why there is difference, but I can give you the fix that may help you figure this out.
    Add overflow:hidden; to the float’s container.

    <div class="container" style="background:#0f0; overflow: hidden;">
    

    this will work to

    .container:after{
                content: "\0020";
                display: block;
                clear: both;
                overflow: hidden;
    }
    

    http://jsfiddle.net/g3Avj/1/

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

Sidebar

Related Questions

Possible Duplicate: Firefox session cookies I'm creating a website in which users are allowed
Possible Duplicate: Access to file download dialog in Firefox I'm using selenium and firefox
Possible Duplicate: css @font-face not working with firefox, but working with chrome and IE
Possible Duplicate: Font and line spacing in different browsers I have to create a
Possible Duplicate: Firefox doesn’t fire $(document).ready(function() { Below code not prompt message box when
Possible Duplicate: Why does javascript object show different values in console in Chrome, Firefox,
Possible Duplicate: Does Firefox support position: relative on table elements? Does Firefox ignore relative
Possible Duplicate: Workarounds for JavaScript parseInt octal bug I would think it has something
Possible Duplicate: Browser Independence issue Code Working for IE but not for Firefox and
Possible Duplicate: Browser-native JSON support (window.JSON) Specifically, is JSON.parse(...) supported by IE7+, Firefox 2+,

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.