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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:52:46+00:00 2026-05-22T14:52:46+00:00

I have two divs under one parent div , the parent div has 100%

  • 0

I have two divs under one parent div, the parent div has 100% width:

<div id="parent">
  <div class="left"></div>
  <div class="right"></div>
</div>

The conditions are:

  • I want two divs on the same line.
  • The right div may or may not be present. When it is present, I want it to always be fixed on the right. However, the left div must be elastic – it’s width depends on its content.

I have tried both float:left, and dispaly:inline-block but neither solution seems to work.

Any suggestion would be appreciated.

  • 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-22T14:52:47+00:00Added an answer on May 22, 2026 at 2:52 pm

    I’d go with @sandeep’s display: table-cell answer if you don’t care about IE7.

    Otherwise, here’s an alternative, with one downside: the “right” div has to come first in the HTML.

    See: http://jsfiddle.net/thirtydot/qLTMf/
    and exactly the same, but with the “right div” removed: http://jsfiddle.net/thirtydot/qLTMf/1/

    #parent {
        overflow: hidden;
        border: 1px solid red
    }
    .right {
        float: right;
        width: 100px;
        height: 100px;
        background: #888;
    }
    .left {
        overflow: hidden;
        height: 100px;
        background: #ccc
    }
    <div id="parent">
        <div class="right">right</div>
        <div class="left">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam semper porta sem, at ultrices ante interdum at. Donec condimentum euismod consequat. Ut viverra lorem pretium nisi malesuada a vehicula urna aliquet. Proin at ante nec neque commodo bibendum. Cras bibendum egestas lacus, nec ullamcorper augue varius eget.</div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two divs #left , and #right . the right div has a
I have a div with two nested divs inside, the (float:left) one is the
I have two divs: one draggable and one droppable <div id=draggable class=block runat=server> </div>
I have two divs, one nested inside of the other. The parent element has
I have two divs, one on the left, and one on the right side
I have two divs like so <div id=parent style=width:100px:overflow:hidden;> <div id=child> tooooooooooooooooooooo much content
I have two divs in a container, the right div has a background image.
I have two divs within a container. One floats left and one floats right.
i have two divs one floated to the left and the other to the
i have two divs with the same ids but one has display=none and the

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.