Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I clip the center column of text during a table resize but leave 2 side columns alone?
    primarykey
    data
    text
    <p>I have a table with three columns of text that I'm having trouble getting to resize properly. The middle column holds a lot of non-crucial text that should be clipped (with an ellipsis) when the page is resized, but the two edge columns hold text that cannot be clipped. None of the text should be wrapped. Here's some example HTML:</p> <pre><code>&lt;table id="resize-table"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th class="col-1"&gt;Column 1&lt;/th&gt; &lt;th class="col-2"&gt;Column 2&lt;/th&gt; &lt;th class="col-3"&gt;Column 3&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td class="col-1"&gt;Unclippable text&lt;/td&gt; &lt;td class="col-2"&gt;Clippable text that is very long. Clippable text that is very long.&lt;/td&gt; &lt;td class="col-3"&gt;Unclippable text&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; </code></pre> <p></p> <p>And here's the css that I'm using:</p> <pre><code>#resize-table{ width:50%; border-collapse:collapse; } #resize-table th{ padding:0.2em; border:1px solid black; } #resize-table td{ padding:0.2em; border:1px solid black; white-space:nowrap; } #resize-table .col-2{ overflow: hidden; text-overflow: ellipsis; } </code></pre> <p>When I resize the page the middle column is never clipped and the ellipsis is never shown. Instead, the table cells just stops shrinking when they reach the width of the content. I've played around a lot with different width settings, but haven't gotten anything to work properly. I've also tried table-layout:fixed but that just results in all the columns being resized equally. Any ideas?</p> <p>EDIT: I'm viewing this in Chrome, but a cross-browser solution would be ideal.</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.
    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