views:

1145

answers:

2

Hi Guys,

Im tryin to get two divs on a page next to each other. The one on the left has to be 100px wide and the one on the right has to take up the remainder of the page, and I want the tect in that div to wrap in it.

I have tried

<div class="video">
    <div class="left">
       left stuff
    </div>
    <div class="right" >right stuff</div>
</div>

.video 
{
    width: 100%;  
    height:75px;
    border-bottom:Solid 1px #c9c9c9;
    position:relative;

}

.video .left 
{ 
    float:left; 
    height:74px; 
    width:116px;
}

.video .right 
{ 
    height:74px; 
    float:left; 
    position:relative; 
    width:180px;

}

Bu this causes the div on the right to drip to the line below. How can I get it to stay on the same line and just occupy the rest of the space that the the left div is not using?

Cheers

A: 

try this:

.video {
 display: table;
 width: 100%;
}
.video .left,
.video .right { 
 display: table-cell;
}
.video .left { 
 width: 100px;
}
antpaw
+1  A: 

Remove the float from the right div and give it a margin-left with the width of the left div.

Here's an SSCCE, the background color is purely presentational, the remaining are the minimum required styles.

<!doctype html>
<html lang="en">
    <head>
        <title>SO question 1909473</title>
        <style>
            .video {
                width: 100%;  
                height: 75px;
                border-bottom: 1px solid #c9c9c9;
            }

            .video .left { 
                float: left; 
                width: 116px;
                height: 74px;
                background: #fee;
            }

            .video .right { 
                margin-left: 116px;
                height: 74px;
                background: #efe;
            }
        </style>
    </head>
    <body>
        <div class="video">
            <div class="left">left stuff</div>
            <div class="right">right stuff</div>
        </div>
    </body>
</html>

Only ensure that you're using strict doctype, otherwise IE will go faulty.

BalusC