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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:40:53+00:00 2026-06-15T15:40:53+00:00

​<div id=’container’> <div class=’left’></div> <div class=’right’></div> <div class=’clear’></div> </div>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ Given the simple markup above,

  • 0
​<div id='container'>
    <div class='left'></div>
    <div class='right'></div>
    <div class='clear'></div>
</div>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

Given the simple markup above, which can be seen in action here at jsFiddle, how do you get the floated right div to take up the remaining height of its parent container that doesn’t have an explicit height? The parent container’s final height is determined by the floated left div.

Typically, I solve this issue through Javascript, and fix the heights after the page has loaded. But, there must be an alternative, standard, and optimal method of how this is handled.

I think this is just an inherent issue of structuring a layout this way, so what is the alternative beyond using a <table>?

  • 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-15T15:40:54+00:00Added an answer on June 15, 2026 at 3:40 pm

    Can’t be done without explicit height on the parent using floats.

    You can however use display: table-; and table-cell which mimics the behavior of tables without actually using them:

    #container { 
        width: 200px;
        background-color: green;
        display: table;
    }
    .left {
        display: table-cell;
        width: 30px;
        height: 200px;
        background-color: red;
    }
    .right {
        display: table-cell;
        height: 100%;
        width: 30px;
        background-color: blue;
    }
    

    This way you don’t need the clearing element and the two divs will always take up 100% of the height, as long as it’s declared.

    http://jsfiddle.net/6XagR/4/
    ​

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

Sidebar

Related Questions

My div with class name 'header-body-right' doesn't seem to be floating to the left
Example Div: <div class=container> <div class=select1></div> <div class=select2></div> <div class=select3></div> </div> Now I want
I have the following div: <div class='amazingmenu' id='menupull'> <img src='images/down.png' width=20 height=20 align='right'/> <div
struct Div { int i; int j; }; class A { public: A(); Div&
I have a div which contain lots of input[type=text] fields. I want to put
div li:first-child what does above css selector target? First li's of every div on
The div 'container' is hidden once I do a mouseover. When I do again
$('div.box').html(hello) puts the word hello inside all my div's of class 'box'. They all
Each div with the class row is added upon request from the user, to
into DIV: <div id=materialcolor></div> I must incject this dynamically generated code: <select class=groupsmaterialcolorsDDs name=group_6

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.