Broda Noel
Broda Noel

Reputation: 2026

How to simulate a html table with a static width row and a dynamic width row

I need to create something like the old html tables, but with css.

Look this structure:

<div id="dad">
    <div id="child-one"></div>
    <div id="child-two"></div>
</div>

So, if "dad" have 1000px (but, remember this is 100%, not 1000px. Let's supouse that the user have a 1000px of resolution), so:

How can I do that? Currently, "child-two" get the width of its content. Example: If into child-two there is an IMG with width:50px, "child-two" will have only 50px... BUT I NEED 700px!!!

Here the best solution: Dynamic width DIV next to a static width DIV

Upvotes: 0

Views: 164

Answers (2)

yoju4n
yoju4n

Reputation: 11

maybe this is what you are looking for

.dad{
    border: 2px solid #000;
    background-color: black;
    width: 100%;
    height: 200px;
    display: table;
}

.child-one{
    background-color: blue;
    width: 300px;
    height: 200px;
    display: block;
}

.child-two{
    background-color: red;
    width: 100%;
    height: 200px;
    display: table-cell;
}

http://jsfiddle.net/j4ngerxb/

Upvotes: 1

SasuQie
SasuQie

Reputation: 9

try this one:

#dad {
   width: 1000px;
}

#child-one {
   width: 30%;
}
#child-two {
   width: 70%;
}

Upvotes: 0

Related Questions