Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is not too difficult, but it doesn't have an exact sizing for the content unless you define it. With this <code>table</code> you'll see the middle column as the widest:</p> <pre><code>&lt;table width="100%" cellpadding="0" cellspacing="0" style="border:none;"&gt; &lt;tr&gt; &lt;td width="150" valign="top"&gt;This is a fixed width column, it's only 50 pixels wide&lt;/td&gt; &lt;td valign="top"&gt;This is a variable width column that has a lot of content&lt;/td&gt; &lt;td valign="top"&gt;This is also a variable width column as well&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>If you swap the content of the middle and last cells you'll see that the content width shift with the content. </p> <pre><code>&lt;table width="100%" cellpadding="0" cellspacing="0" style="border:none;"&gt; &lt;tr&gt; &lt;td width="150" valign="top"&gt;This is a fixed width column, it's only 50 pixels wide&lt;/td&gt; &lt;td valign="top"&gt;This is also a variable width column as well&lt;/td&gt; &lt;td valign="top"&gt;This is a variable width column that has a lot of content&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Now, you can also play off this by nesting a table in a cell with a fixed width. In the next example, it is the center column. This way you can let last column's width grow and just take up the space.</p> <pre><code>&lt;table width="100%" cellpadding="0" cellspacing="0" style="border:none;"&gt; &lt;tr&gt; &lt;td width="150" valign="top"&gt;This is a fixed width column, it's only 50 pixels wide&lt;/td&gt; &lt;td valign="top"&gt; &lt;table width="130" cellpadding="0" cellspacing="0" style="border:none;"&gt; &lt;tr&gt; &lt;td&gt;This is a fixed width table's content inside of a nested table&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;td valign="top"&gt;This is a variable width column that has a lot of content and should push the boundaries&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>With that, you have a few strategies for how to handle fluid content within a table.</p> <p>*<em>*</em> -- UPDATE -- **</p> <p>Perhaps I read that wrong, sorry. </p> <p>Tables operate to always get the column width from the widest cell. If you have several rows with content of varying width the columns will all inherit the widest cell width within the column. So, to make a table's column fixed width you either need to have content that is a fixed width or wrap the content in an element that is a fixed width.</p> <p>gMail, Google Reader, and a lot of online email clients use a similar approach to have a fixed width nav on the left and let the rendering area grow with the user's browser. </p> <pre><code>&lt;table width="100%" cellpadding="0" cellspacing="0" style="border:none;"&gt; &lt;tr&gt; &lt;td valign="top"&gt; &lt;table width="50" cellpadding="0" cellspacing="0" style="border:none;"&gt; &lt;tr&gt; &lt;td&gt;This is a fixed width column, it's only 50 pixels wide&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;td valign="top"&gt; &lt;table width="130" cellpadding="0" cellspacing="0" style="border:none;"&gt; &lt;tr&gt; &lt;td&gt;This is a fixed width table's content inside of a nested table&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;td valign="top"&gt;This is a variable width column that has a lot of content and should push the boundaries&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>They normally do this in CSS but with this approach you do not define the width of the table cells. They will just inherit their width from the content. The third column, which has no fixed width on its content, will grow with the user's web browser width and be fluid.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload