Jump to content

a max height to a table


FARGORE
 Share

Recommended Posts

Greetings What I want to do is have a table of data on a web page. The amount of data in the table can change but I want there to be a max height to the table so if the size of the table gets to long it will use scroll bars instead of actually making the table larger.So basically I want to make a table that has a MAX height but can present any amount of information. I tried to find a way of doing this with CSS and could not find a max height option. I found the Iframe HTML tag and that seems like it will do what I want but my question is, is that the best way or is there a better way? Thank you very much to anyone who takes time to answer my question. I hope everyone is having a good day.

Link to comment
Share on other sites

Make your table a fixed height: 300px height or whatever you want the max to be. Inside your table add a <div> with an overflow of auto and a height of the max size you want. If anything goes outside the 300px (in my example) then scroll bars will appear. What does the trick is the <div> and the overflow: auto;, overflow doesn't work quite right on <td> so you're better off using a div.

<table style="height:300px;">  <tr>	<td>	  <div style="overflow:auto; height:300px;">YOUR CONTENT HERE</div>	</td>  </tr></table>

Edited by Err
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...