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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:53:25+00:00 2026-05-27T12:53:25+00:00

Recently I was looking through some website’s code, and saw that every <div> had

  • 0

Recently I was looking through some website’s code, and saw that every <div> had a class clearfix.

After a quick Google search, I learned that it is for IE6 sometimes, but what actually is a clearfix?

Could you provide some examples of a layout with a clearfix, compared to a layout without a clearfix?

  • 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-05-27T12:53:26+00:00Added an answer on May 27, 2026 at 12:53 pm

    If you don’t need to support IE9 or lower, you can use flexbox freely, and don’t need to use floated layouts.

    It’s worth noting that today, the use of floated elements for layout is getting more and more discouraged with the use of better alternatives.

    • display: inline-block – Better
    • Flexbox – Best (but limited browser support)

    Flexbox is supported from Firefox 18, Chrome 21, Opera 12.10, and Internet Explorer 10, Safari 6.1 (including Mobile Safari) and Android’s default browser 4.4.

    For a detailed browser list see: https://caniuse.com/flexbox.

    (Perhaps once its position is established completely, it may be the absolutely recommended way of laying out elements.)


    A clearfix is a way for an element to automatically clear its child elements, so that you don’t need to add additional markup. It’s generally used in float layouts where elements are floated to be stacked horizontally.

    The clearfix is a way to combat the zero-height container problem for floated elements

    A clearfix is performed as follows:

    .clearfix::after {
       content: " "; /* Older browser do not support empty content */
       visibility: hidden;
       display: block;
       height: 0;
       clear: both;
    }
    

    Or, if you don’t require IE<8 support, the following is fine too:

    .clearfix::after {
      content: "";
      display: table;
      clear: both;
    }
    

    Normally you would need to do something as follows:

    <div>
        <div style="float: left;">Sidebar</div>
        <div style="clear: both;"></div> <!-- Clear the float -->
    </div>
    

    With clearfix, you only need the following:

    <div class="clearfix">
        <div style="float: left;" class="clearfix">Sidebar</div>
        <!-- No Clearing div! -->
    </div>
    

    Read about it in this article – by Chris Coyer @ CSS-Tricks

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

Sidebar

Related Questions

I have been looking through some code on an open source project recently and
Recently, I was looking through some SOAP-about documentation and saw few SOAP calls\responses. Of
I've recently joined an iPad project. In looking through the code base I've come
I was recently looking at some web hosting solutions and some of the providers
I've been looking into checkstyle recently as part of some research into standard coding
I have recently started studying Google Web Toolkit. I have went through some walkthroughs,
I have recently inherited some Java code and need to integrate it into a
I have some code in an asp.net app that needsto get the ipv4 address
I've recently taken some classes in networking (CCNA 1 through 4), so I understand
I've recently been looking for a regular expression to do some client side date

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.