Tower
Tower

Reputation: 102785

How to make a div inside a td to stretch?

I have a table like:

<table>
<tr>
<td>...</td>
<td><div class="stretch"></div></td>
</tr>
</table>

I need to get the .stretch to fit the height of the td. Currently the div has a height of 0. What am I missing?

Upvotes: 5

Views: 5800

Answers (3)

Oakcool
Oakcool

Reputation: 1496

This should work

<table style="width: 200px; height: 200px">
    <tr>
        <td style="border: thin solid #FF0000; height:200px">            
            <div style="border: thin solid #0000FF;  width:100%; height:100%;">

            </div>
        </td>
    </tr>
</table>

Upvotes: 0

anggriawan
anggriawan

Reputation: 234

.stretch {
height: 100%;
}

Upvotes: 1

Breezer
Breezer

Reputation: 10490

the td must have a set size then you set the div's height:100%; or inherit pretty the same thing and you'll be good to go

Upvotes: 6

Related Questions