HTML
<div id="a">
<table id="b">
<tr><td></td></tr>
</table>
</div>
CSS
* {
margin: 0;
padding: 0;
}
#a {
background-color: yellow;
}
#b {
background-color:red;
height: 50px;
margin-left: 50px;
width: 100%;
}
I want the table #b
to span from 50px from the left of its container (#a
) all the way to the right edge of of #a
.
By setting the width to 100%
it goes off the page because it tries matching the width of #a
. If I omit the width then the table is too small.
Setting the table to display:block
and removing the width seems to give the desired behaviour. Is this reliable, or is there another method of achieving the same thing? I'd prefer not to resort to absolute positioning.