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

  • SEARCH
  • Home
  • 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 574199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:48:20+00:00 2026-05-13T13:48:20+00:00

Could anyone explain when should the floated elements get cleared? I have noticed sometimes

  • 0

Could anyone explain when should the floated elements get cleared?

I have noticed sometimes when I make something in HTML, and I don’t clear them, it still all looks good!

Also can overflow:hidden be used as a replacement for clearing?

Look at this example:

<html>
<head>
  <style>
    .a { background-color: red; overflow: hidden }
    .floated-left { float: left; width: 100px; height: 100px; background-color: blue; }
  </style>
</head>

<body>
  <p>div with class a, that does have overflow:hidden:</p>
  <div class="a">
    <div class="floated-left">Hi,</div>
    <div class="floated-left">Mom!</div>
  </div>

  <p>i didn't clear anything</p>
</body>
</html>

Here I didn’t clear the floated divs, but set overflow:hidden for the .a class and the <p> below appeared in normal element flow.

However, if I removed overflow:hidden from the .a class, <p> gets displaced.

Please explain!

Thanks, Boda Cydo.

  • 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-13T13:48:20+00:00Added an answer on May 13, 2026 at 1:48 pm

    For block-level, non-replaced elements, when overflow isn’t set to “visible” and height isn’t “auto”, the element’s height depends on its descendents (CSS 2.1 § 10.6.6). Thus when you set overflow: hidden on .a, it stretches to contain the floated descendents. The <p> is below .a, so it’s below the floats.

    Without overflow: hidden, .a doesn’t contain the floated children; its calculated height is 0. The <p> is still below .a, but not the floats. The floats push the inline content of <p>, as floats are wont to do.

    Try putting borders around .a and paragraphs to more clearly see the difference.

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

Sidebar

Related Questions

Could anyone explain the word regression test in an understandable way?
Could anyone explain the reasoning behind making say ItemsControl.DisplayMemberPath a dependency property and not
I had a need for a method that could take a collection of strings,
In another question, other users offered some help if I could supply the array
I am using C# 3.5 and the reactive extension supporting TPL in C# version
I'm currently re-developing a fairly large-scale PHP web application. Part of this redevelopment involves
When I started with Windsor I thought DI would be simple. Now it's causing
From my previous question, Converting chinese character to Unicode , I had a good
I am writing a test for my library written in C#. And I want
When reading Wikipedia's entry on Haskell 2010 I stumbled across this: -- using only

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.