防止DIV高度超过某个值

时间:2014-05-29 13:59:44

标签: html css

DIV TD内有TD女巫的长篇文章。 90px宽度固定为max-height: 60px和DIV <html> <head> <style> .medium { width:90px; max-width:90px; overflow: auto; word-break: break-all; } div.scrollable { overflow:auto; max-height:60px; /* 3 lines maximum */ height:60px; text-align:left; white-space: pre-wrap; /* preserve the text formatting */ } </style> </head> <body> <table> <tr> <td class="medium"> <div class="scrollable">In my design I've multiple Div that contain some text and one of them is a lot bigger that the height of a normal screen resolution. In my design I've multiple Div that contain some text and one of them is a lot bigger that the height of a normal screen resolution.In my design I've multiple Div that contain some text and one of them is a lot bigger that the height of a normal screen resolution.In my design I've multiple Div that contain some text and one of them is a lot bigger that the height of a normal screen resolution.</div> </td> </tr> </table> </body> </html> 。 在Chrome和FireFox中没关系,它是60px乘90px的垂直滚动条,但在Internet Explorer中,它的DIV高度调整为文本长度,没有滚动条。

我希望div的高度能够调整到最大60px并且如果内容更大则有滚动条。在Chrome,FireFox和Internet Explorer 11中。

{{1}}

0 个答案:

没有答案