How to fix height of TR?

前端 未结 7 727
情深已故
情深已故 2020-11-27 02:50

Is it possible to fix the height of a row (tr) on a table?

The problem appears when I shrink the window of the browser, some rows start playing around, and I can not

7条回答
  •  情歌与酒
    2020-11-27 03:42

    Tables are iffy (at least, in IE) when it comes to fixing heights and not wrapping text. I think you'll find that the only solution is to put the text inside a div element, like so:

    td.container > div {
        width: 100%;
        height: 100%;
        overflow:hidden;
    }
    td.container {
        height: 20px;
    }
    This is a long line of text designed not to wrap when the container becomes too small.

    This way, the div's height is that of the containing cell and the text cannot grow the div, keeping the cell/row the same height no matter what the window size is.

提交回复
热议问题