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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:02:47+00:00 2026-06-18T22:02:47+00:00

I am relying on the CSS property overflow:hidden to contain 3 nested & floated

  • 0

I am relying on the CSS property overflow:hidden to contain 3 nested & floated divs. The overflow:hidden is applied to the parent div of this html.

When I don’t use overflow:hidden my last div is out of place within a line of floated divs, but when I do use overflow:hidden the entire div structure moves downwards.

Hopefully someone can understand what I mean by the text above, but in-case not I’ll provide CSS code too.

CSS:

#header {
  display: block;
  width: 590px;
  height: 50px;
  background: #336699;
  margin: 0 auto;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4px;

  overflow: hidden;
}

.header-left-wrapper {
  float: left;
  width: 150px; height: 50px;
  background: #ff0000;
}
.header-input-wrapper {
  float: left;
  width: 300px; height: 50px;
  background: #00ff00;
}
.header-right-wrapper {
  float: right;
  width: 140px; height: 50px;
  background: #ff0000;
  overflow: hidden;
}

To clarify, for some reason when I apply overflow:hidden to .header-right-wrapper, the entire header moves down as if I just applied a margin or position. Any help? Thanks in advance.

  • 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-18T22:02:48+00:00Added an answer on June 18, 2026 at 10:02 pm

    .header-right-wrapper is dropping because, as a floated element, it needs to clear something else on the page (.close). When you give #header {overflow: hidden} it’s forced to contain its children, at least to the point that it reaches its {height}, including that floated div. Therefore it moves down. The problem is not your markup related to #header, but the Lightbox layout as a whole. Here’s one fix:

    .close {margin-bottom: -100px;}
    

    http://jsfiddle.net/ZETus/4/

    Another approach would be to take .close out of the flow using absolute positioning, so that the float doesn’t have to clear it:

    http://jsfiddle.net/ZETus/5/

    .close {
        position: absolute;
        right: -10px;
        top: -10px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

currently i am relying on a proxy script to handle this problem of Single
Possible Duplicate: Is relying on && short-circuiting safe in .NET? I wasn't sure how
Instead of relying on the server to gizip compress css and js file, is
I am relying on $(window).width(); & $(window).height(); for a resizing function and they seem
I have been heavily relying on CSS for a website that I am working
I'm relying on this macro to produce random sequences at the moment, and I
I've built this website relying heavily on JQuery, and have run into an issue
this window status bar.How to make the icon has been relying on the right
I'm working on a project which injects JS+CSS+HTML over web pages which I do
Relying on the preprocessor and predefined compiler macros for achieving portability seems hard to

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.