简体   繁体   English

固定表格单元格的高度

[英]Fix a table cell's height

So, what I want to do is have a list within a cell that has items added to it and after it reaches a certain height, stop it and have a scroll bar appear. 因此,我想做的是在一个单元格中有一个列表,该列表中添加了项,达到一定高度后,将其停止并显示滚动条。 How can I create a td with a fixed height? 如何创建固定高度的td? So far I have: 到目前为止,我有:

<tr>
  <td valign='top' height="200px" border="1">
    <ul id="travelList" align='left'></ul>
  </td>
</tr>

I would put your <ul> inside a div that has overflow auto and max-height. 我会将您的<ul>放入具有溢出auto和max-height的div中。 Like this: 像这样:

<tr>
  <td valign="top" border="1">
    <div style="overflow:auto;max-height:200px">
      <ul id="travelList" align="left"></ul>
    </div>
  </td>
</tr>

try adding: 尝试添加:

style="max-height:200px"

note: not tested, but this is where you'd start, so google CSS max-height to get more detail of how heights work. 注意:未经测试,但这是您要开始的地方,因此google CSS max-height可以获取更多有关高度如何工作的详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM