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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:54:32+00:00 2026-06-05T10:54:32+00:00

Question: I have the below HTML and want to have two divs horizontally next

  • 0

Question:

I have the below HTML and want to have two divs horizontally next to each other.
The left div should have the same height as the right div (or vice-versa if the left div’s height is greater than the right div’s height).
The left div’s size should be a fixed size in pixel, and the right div should expand to fill the container (no width to set), in this case 500px.

I don’t want to set a width on the second div, because ultimately, I want to set the wrapper’s size as percent.

With the HTML below, the second div goes below the first div.
Can anybody tell me how to fix this according to my wishes (should work in IE 9, too) ?

<!DOCTYPE html>

<html>
<head>
    <title>Index</title>


    <style type="text/css" media="all">


        #wrapper 
        { 
            width: 500px; /* or say, 25% */
            border: 1px solid black; 
            overflow: hidden; /* add this to contain floated children */ 
        }

        #first 
        { 
            width: 100px; 
            float:left;
            border: 1px solid red; 
        }

        #second 
        { 
            border: 1px solid green; 
            width: 400px; /* don't want this */
            float: left;
        } 


    </style>

</head>


<body>

<div id="wrapper">
    <div id="first">
        Test left
        <br />
        Test left
    </div>
    <div id="second">
        Test right
        <br />
        Test right
        <br />
        Test right
        Auf der Registerkarte 'Einfügen' enthalten die Kataloge Elemente, die mit dem generellen Layout des Dokuments koordiniert werden sollten. Mithilfe dieser Kataloge können Sie Tabellen, Kopfzeilen, Fußzeilen, Listen, Deckblätter und sonstige Dokumentbausteine einfügen. Wenn Sie Bilder, Tabellen oder Diagramme erstellen, werden diese auch mit dem aktuellen Dokumentlayout koordiniert. Die Formatierung von markiertem Text im Dokumenttext kann auf einfache Weise geändert werden, indem Sie im Schnellformatvorlagen-Katalog auf der Registerkarte 'Start' ein Layout für den markierten Text auswählen. Text können Sie auch direkt mithilfe der anderen Steuerelemente auf der Registerkarte 'Start' formatieren. Die meisten Steuerelemente ermöglichen die Auswahl zwischen dem Layout des aktuellen Designs oder der direkten Angabe eines Formats. Wählen Sie neue Designelemente auf der Registerkarte 'Seitenlayout' aus, um das generelle Layout des Dokument s zu ändern. Verwenden Sie den Befehl zum Ändern des aktuellen Schnellformatvorlagen-Satzes, um die im Schnellformatvorlagen-Katalog verfügbaren Formatvorlagen zu ändern. Die Design- und die Schnellformatvorlagen-Kataloge stellen beide Befehle zum Zurücksetzen bereit, damit Sie immer die Möglichkeit haben, das ursprüngliche Layout des Dokument s in der aktuellen Vorlage wiederherzustellen. Auf der Registerkarte 'Einfügen' enthalten die Kataloge Elemente, die mit dem generellen Layout des Dokuments koordiniert werden sollten.
    </div>
</div>


</body>
</html>
  • 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-05T10:54:34+00:00Added an answer on June 5, 2026 at 10:54 am

    If you are using border then your width has additional 2px.So Add 4px to wrapper width

    #wrapper 
    { 
        width: 504px; /* or say, 25% */
        border: 1px solid black; 
        overflow: hidden; /* add this to contain floated children */ 
    }
    
    #first 
    {   
        width: 100px; 
        float:left;
        border: 1px solid red; 
    }
    
    #second 
    {  
        border: 1px solid green; 
        width: 400px; /* don't want this */
        float: left;
    }
    

    Update :-Use table layout for this simple thing

     #wrapper 
            { display:table-row;
                width: 500px; /* or say, 25% */
                border: 1px solid black; 
                overflow: hidden; /* add this to contain floated children */ 
            }
    
            #first 
            { display:table-cell;
                width: 100px; 
                border: 1px solid red; 
            }
    
            #second 
            { display:table-cell;
                border: 1px solid green; 
             }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question, here are two classes below: class Base{ public: virtual void
I have a simple but subtle question. Below you see two different declaration variants
This might be a confusing question but I have written below a Directory crawler,
I have a question which is described below: What problems would arise for testing
I have a figure below: And my question is that the objects in Array
I have a basic PHP question, take the code below for example, let's say
Edit: original question below, but I revise it now that I have some code
This question is related to a WPF application. I have a class as below
Problem solved, see below Question I'm working in Flex Builder 3 and I have
I have two questions regarding to html table layout. First I will provide some

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.