Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

control table height

Status
Not open for further replies.

waely

Programmer
Dec 7, 2003
227
US
Hi guys,
I'm trying to control a height of a table and for some reason it prevents from shrinking it beyond the default table height. I like to make the height to be 5 or 6 pixels only. I tried to set the properties of the <td> to Height=&quot;5&quot; but the table has never changed.

I appreciate any help.
 
The attribute height in a TD tag is poorly named. It is really the minimum height for a table row. So if your content of a table cell is greater than what you put in the height attribute, the table row will increase to make the content fit.

Also, just because you have one TD set to a height=5, if there is another TD on the same row with content. The whole row will take on the size of the cell with the largest content. Does that make sense?

Ok, if you really want to control the height of a table cell, you need to put something very small in it and leave that row alone (like by using a colspan attribute or something) I like to have a 1x1 transparent GIF called &quot;blank.gif&quot; that I use as the content of the table cell. That way the height (and width) will be what I want.

Example:
Code:
<TR>
<TD height=&quot;5&quot; colspan=&quot;3&quot;><IMG src=&quot;blank.gif&quot; width=&quot;1&quot; height=&quot;1&quot; alt=&quot;&quot;></TD>
</TR>
Does that make sense now?

Einstein47
(&quot;Tribulations are God's megaphone to awaken a deaf world.&quot; - C.S. Lewis)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top