Reputation: 63758
<table>
has a set width of 1000px.
It has 5 <td>
elements each with a width of 300px.
Does table expand to contain all the <td>
children despite me explicitly setting the width?
Upvotes: 1
Views: 884
Reputation: 191809
This likely depends on the browser as well as how the widths are actually specified, but in your case most likely the table cells will be resized to fit the width of the entire table. A description of calculating table width: http://www.w3.org/TR/CSS2/tables.html#width-layout
table-layout: fixed
will use the fixed table layout algorithm which will calculate the table width from the normal box model using its contents (and be 1500px in your case). You can also do this by having block level elements as the contents of the <td>
s.
Upvotes: 1
Reputation: 1489
The child elements (the td
's) will resize to fit the width of the table.
Upvotes: 0
Reputation: 1989
No. The table will not exceed a set width no matter the width of it's child columns. The table in your example will be 1000 px wide, not 1500 px wide.
Upvotes: 0
Reputation: 196236
The width you apply to the table
is the most important.
The td
elements will resize to fit inside the table
Upvotes: 1