Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS how to make <TD> a fixed height?

Tags:

html

css

<table  cellspacing="0" id="contactTable" style="table-layout:table-layout:fixed;; width:100%; font-weight:normal; position: absolute; top:45; left: 0;">  <td height="50" style="padding-left:5px; overflow:hidden; ">     <span style="text-transform:capitalize;line-height:100%;">     //names here     </span>                               </td>  ...more code </table> 

This doesn't work. Overflow is still making the cell taller, height is addapting to content.

like image 929
Dave819 Avatar asked Feb 23 '11 12:02

Dave819


1 Answers

The best solution is to put a div inside the cell with the height:

<td style="padding-left:5px;">   <div style="height: 50px; overflow:hidden;">       ...   </div> </td> 

BTW, what is the span for? If you only need it for styling, you can style the cell directly instead.

like image 156
RoToRa Avatar answered Oct 07 '22 16:10

RoToRa