Note that there are some explanatory texts on larger screens.

plurals
  1. POTable cell text overflow issues
    primarykey
    data
    text
    <p>After asking a question about this earlier, I finally figured out the problem specifically. This is the code I am having trouble with:</p> <p><strong>CSS</strong></p> <pre><code>table { display: block; margin: 30px 0 auto 0; width: 100%; max-width: 1300px; text-align: left; white-space: nowrap; border-collapse: collapse; table-layout:fixed; } td { max-width: 200px; overflow: hidden; white-space: nowrap; word-wrap:break-word; text-overflow: ellipsis; border: 1px solid black; } </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;th style="width: 18%;"&gt;Col 1&lt;/th&gt; &lt;th style="width: 12%;"&gt;Col 2&lt;/th&gt; &lt;th style="width: 13%;"&gt;Col 3&lt;/th&gt; &lt;th style="width: 7%"&gt;Col 4&lt;/th&gt; &lt;th style="width: 7%"&gt;Col 5&lt;/th&gt; &lt;th style="width: 6%"&gt;Col 6&lt;/th&gt; &lt;th style="width: 5%"&gt;Col 7&lt;/th&gt; &lt;th style="width: 13%"&gt;Col 8&lt;/th&gt; &lt;th style="width: 16%"&gt;Col 9&lt;/th&gt; &lt;th style="width: 3%"&gt;Col 10&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Some&lt;/td&gt; &lt;td&gt;Data&lt;/td&gt; &lt;td&gt;Stuff&lt;/td&gt; &lt;td&gt;foo&lt;/td&gt; &lt;td&gt;bar&lt;/td&gt; &lt;td&gt;etc&lt;/td&gt; &lt;td&gt;whatever&lt;/td&gt; &lt;td&gt;stuff&lt;/td&gt; &lt;td&gt;Alotofdatakkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk&lt;/td&gt; &lt;td&gt;Yes&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Pretty much, I want the long data to be trimmed according to the percent width in the header (16% in this case). Only problem is that this does not work in html5: (In this image, left is without a and the right is with one)</p> <p><img src="https://i.stack.imgur.com/L9i7v.png" alt="http://puu.sh/2T9N7.png"></p> <p>The left is what I want the data to look like. Now before someone says "just add max-width: 100px; or so" that is something I cannot do. It works fine like that, sure, until you start dealing with percents then max-width magically decides not to work. I also feel like there is an easier way than specifying the max-width on every single cell (left example without html5 doctype proves this as well).</p> <p><em>In short:</em> I am trying to get text within a cell to be auto cut off with ellipses depending on the width of its corresponding header width.</p> <p>This is getting pretty annoying because I have been trying to figure this out for hours now so any help would be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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