Note that there are some explanatory texts on larger screens.

plurals
  1. POalign 2 table column widths with each other
    text
    copied!<p>I have 2 tables one on top of the other and I would like to align their column widths exactly with each other, is there a way to do this? Tried fixed table col widths etc no joy</p> <p>You can see on fiddle the columns are slightly off each other <a href="http://jsfiddle.net/askhe/">http://jsfiddle.net/askhe/</a></p> <p>HTML</p> <pre><code>&lt;table class="tblresults txtblack"&gt; &lt;tr class="tblresultshdr bold"&gt; &lt;td class="col1"&gt;Company&lt;/td&gt; &lt;td&gt;Currency&lt;/td&gt; &lt;td&gt;Bid&lt;/td&gt; &lt;td&gt;Ask&lt;/td&gt; &lt;td&gt;YTD Vol&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="col1"&gt;ABC&lt;/td&gt; &lt;td&gt;GBP&lt;/td&gt; &lt;td&gt;94&lt;/td&gt; &lt;td&gt;16&lt;/td&gt; &lt;td&gt;3,567,900&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="col1"&gt;DEF&lt;/td&gt; &lt;td&gt;GBP&lt;/td&gt; &lt;td&gt;3&lt;/td&gt; &lt;td&gt;46&lt;/td&gt; &lt;td&gt;10,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="col1"&gt;GHI&lt;/td&gt; &lt;td&gt;GBP&lt;/td&gt; &lt;td&gt;3&lt;/td&gt; &lt;td&gt;46&lt;/td&gt; &lt;td&gt;10,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="col1"&gt;JKLM&lt;/td&gt; &lt;td&gt;GBP &lt;/td&gt; &lt;td&gt;7&lt;/td&gt; &lt;td&gt;46&lt;/td&gt; &lt;td&gt;56,000&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;table class="tblresults txtblack margintop10"&gt; &lt;tr&gt; &lt;td colspan="5" class="bold" &gt;Investments&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="col1"&gt;ghjk&lt;/td&gt; &lt;td&gt;GBP&lt;/td&gt; &lt;td&gt;13&lt;/td&gt; &lt;td&gt;6&lt;/td&gt; &lt;td&gt;130,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="col1"&gt;asdsa&lt;/td&gt; &lt;td&gt;GBP&lt;/td&gt; &lt;td&gt;120&lt;/td&gt; &lt;td&gt;46&lt;/td&gt; &lt;td&gt;16,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="col1"&gt;dfdsfsdf &lt;/td&gt; &lt;td&gt;GBP&lt;/td&gt; &lt;td&gt;1&lt;/td&gt; &lt;td&gt;4&lt;/td&gt; &lt;td&gt;13,000&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;​ </code></pre> <p>CSS</p> <pre><code>table.tblresults { width:100%; *width:99.5%; border: 1px solid #b9b8b8; top: 0; } table.tblresults tr.tblresultshdr {background: lightgrey;} table.tblresults tr.tblresultshdr td {padding: 6px;} table.tblresults td {padding: 8px; border: 1px solid #b9b8b8;} table.tblresults td.col1 {width: 70%;} ​ </code></pre>
 

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