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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:50:09+00:00 2026-05-27T22:50:09+00:00

In CSS the overflow:hidden is set on parent containers in order to allow it

  • 0

In CSS the overflow:hidden is set on parent containers in order to allow it to expand with the height of their floating children.

But it also has another interesting feature when combined with margin: auto…

If PREVIOUS sibling is a floating element, it will actually appear juxtapose to it. That is if the sibling is float:left then the container with float:none overflow:hidden will appear to the right of the sibling, no newline – just as if it was floating in the normal flow. If the previous sibling is float:right then the container will appear to the left of the sibling. Resizing this container will accurately show it centered inbetween the floating elements. Say if you have two previous siblings, one float:left the other float:right, the container will appear centered inbetween the two.

So here’s the problem…

How do I maintain that type of layout WITHOUT masking children?

Googling all over the web gives me ways on how to clear:both and expand a container… but I can’t find any alternative solution to maintaining the left/right previous-child centering. If you make the container overflow:visible then the container suddenly ignores the layout flow of the floating elements and appears layered ontop of the floating element.

So question:

I have to have the container overflow:hidden to preserve layout…

how can I make it so the children aren’t masked? I need to have the child absolutely positioned relative to the parent outside the container.

OR

How do I overflow:visible so I can absolutely position a child relative to the parent outside the container… YET preserve the sibling float-like-layout-flow?

  • 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-27T22:50:10+00:00Added an answer on May 27, 2026 at 10:50 pm

    You can use the clearfix to do “layout preserving” the same way overflow: hidden does.

    .clearfix:before,
    .clearfix:after {
        content: ".";    
        display: block;    
        height: 0;    
        overflow: hidden; 
    }
    .clearfix:after { clear: both; }
    .clearfix { zoom: 1; } /* IE < 8 */
    

    add class="clearfix" class to the parent, and remove overflow: hidden;

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

Sidebar

Related Questions

Situation: I have two fixed-height divs, overflow set to hidden on both, and dynamic
// resize myiframe base on content height $('.myiframe').contents().find('body').css({min-height: 100, overflow : hidden}); setInterval( $('.myiframe').height($('.myiframe').contents().find('body').height()
I have a DIV with a set height and overflow: hidden . Inside the
I have a container div with the following CSS: #container { position:relative; overflow:hidden; width:200px;
I have defined a tag with a CSS attribute overflow set to scroll. This
I've got two divs (#mosaicBlog and #mosaicAside). I've got #mosaicAside's CSS set to overflow
This is a weird one: .naReduced{ max-height: 200px; height:200px; width: auto; overflow:hidden; border: blue
I need some help with CSS overflow in IE, namely IE 7. I want
I just saw this mentioned in Stack Overflow question Best WYSIWYG CSS editor and
CSS Attribute selectors allow the selection of elements based on attribute values. Unfortunately, I've

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.