Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to hide table row overflow (take 2)
    primarykey
    data
    text
    <p>I need to ensure that all rows of my table are fixed height, even if the cells contain content with embedded line breaks or other characteristics that would otherwise cause them to enlarge. </p> <p>Basically I just want to set <code>td { height: 1.2em; overflow: hidden; }</code> but that doesn't work for reasons that are still a mystery to me.</p> <p>What I've tried:</p> <ul> <li><code>table { table-layout:fixed; }</code> from <a href="https://stackoverflow.com/questions/1554928/how-to-hide-table-row-overflow">How to hide Table Row Overflow</a>.</li> <li><code>table { display: block; }</code> just makes it wider.</li> <li><code>td { white-space: nowrap; }</code> doesn't affect the embedded <code>&lt;br /&gt;</code>.</li> <li><code>td { line-height: 0; }</code> reduced row height, but the text rows overlap each other unreadably (from <a href="https://stackoverflow.com/questions/6398172/setting-table-row-height-in-css">Setting table row height in CSS</a>)</li> <li><code>tr { height: 1em; }</code> and <code>td { height: 1em; }</code> combined made no difference (from <a href="https://stackoverflow.com/questions/2092696/how-to-fix-height-of-tr">How to fix height of TR</a>)</li> <li><code>td { text-overflow: ellipsis; }</code> made no difference</li> <li><code>table { height: 1em; }</code> made no difference (from <a href="https://stackoverflow.com/questions/1806371/css-fix-row-height">css: fix row height</a>)</li> <li>I don't want to use Javascript hacks like <a href="https://stackoverflow.com/questions/5239758/css-truncate-table-cells-but-fit-as-much-as-possible">CSS: Truncate table cells, but fit as much as possible</a></li> </ul> <p>The only thing that seems to work is <code>td { display: block; }</code>, but I'm wary of this because, as far as I know, browsers don't really know how to render something that's not a table-cell inside a table. Is this actually supported? Is there a better alternative?</p> <p>You can see and fiddle with the combinations that I've attempted on <a href="http://jsbin.com/iwIkeze/3/edit" rel="nofollow noreferrer">jsbin</a>.</p> <p>Background: This is for a <a href="https://github.com/qris/com.qwirx.grid" rel="nofollow noreferrer">data grid component</a>, similar to <a href="http://dojofoundation.org/packages/dgrid/" rel="nofollow noreferrer">dgrid</a>, and if the rows change size as you scroll up and down, it results in jumpy, vibrating scrolling and an unhappy user experience.</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.
 

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