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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:57:02+00:00 2026-06-13T02:57:02+00:00

I am trying to float some elements and apply clearfix so that the parent

  • 0

I am trying to float some elements and apply clearfix so that the parent element can expand to the height and width of the children.

So, I simply set up the layout as per this fiddle: http://jsfiddle.net/fMjEx/

I then wanted to float the elements inside .bar. This is usually quite straight forward:

  1. Float the elements.
  2. Clear fix the parent using pie-clearfix or overflow: auto.

However, I ran into these problems:

  • If I use pie-clearfix, the element .picture which is next to .bar is also included in the clearing: http://jsfiddle.net/6C7WD/

  • If I use overflow: auto or overflow: hidden, the width of the .bar no longer spans the width of the document: http://jsfiddle.net/fv2gA/

Initially, one solution I had was to make .picture position: absolute. However, the problem with this approach is that the element is taken out of the flow.

In the layout, the height of .bar is variable depending on the content inside. I would like to give .bar and .picture a margin-bottom so that anything that comes after them is pushed downwards by that amount depending on whether .bar or .picture has a greater height.

This rules out using position: absolute on .picture as a solution.

Are there any solutions that satisfy the following?

  • Clear only floats within .bar.
  • Does not remove any elements from the 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-06-13T02:57:04+00:00Added an answer on June 13, 2026 at 2:57 am

    This is the solution I ended up with:

    Added a wrapper to the markup:

    <div class="container">
    
    <div class="group"> <-------------------------- This is the wrapper
        <div class="picture"></div>
        <div class="bar">
            <div class="info"> some text goes here</div>
            <div class="buttons">some other content goes here</div>
        </div>
    </div>
    </div>
    

    And the CSS:

    .picture{
        width: 100px;
        height: 100px;
        float: left;
        background: green;
        margin-left: 100px;
        margin-top: 10px;
        z-index: 2;
        position: relative;
    }
    
    .bar{
        background: blue;
        margin-top: -80px;
        overflow: auto;
        width: 100%;
        float: left;
        z-index: 1;
        position: relative;
    }
    
    .group{
        margin-bottom: 10px;
    }
    
    .group:after {
        clear: both;
        content: "";
        display: table;
    }
    
    .info, .button{
        float: left;
        margin-left: 200px;
    }
    
    .container{
        overflow: auto;
    }
    

    Fiddle of the above: http://jsfiddle.net/c6Lng/

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

Sidebar

Related Questions

I'm trying to put some (vertically-stacked) display:block elements within a display:inline-block element. According to
I am trying to find some float number (like -1234.5678) in a huge text
I'm trying to float a span right in my message bar. For some reason
Im trying to stretch the individual li elements within the nav element to fill
I'm trying to position div as a footer inside parent div. <div> ...some content...
I'm trying box up a list of elements and display a some text below
I am trying to create a list that will float on the right side
I'm trying to create an info tag that hangs off of a block element
I'm somehow new to templates and I'm trying to modify some library that provide
I'm somehow new to templates and I'm trying to modify some library that provide

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.