Jupiter
Jupiter

Reputation: 238

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? So far I have:

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

Upvotes: 0

Views: 340

Answers (2)

codefactor
codefactor

Reputation: 1646

I would put your <ul> inside a div that has overflow auto and max-height. Like this:

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

Upvotes: 3

Taryn East
Taryn East

Reputation: 27747

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.

Upvotes: 0

Related Questions