Log in

View Full Version : help with middle alignment of cell in table



biomike
12-15-2009, 02:59 PM
I am trying to get the text in the left column to have a middle allignment rather than top. It would appear that the style code below in the header is overriding the code for this cell. any suggestions please.


<style type="text/css">
td {
vertical-align: top;
}
</style>




<td width="720" valign="middle" align="center" height="35">
<p style="margin-top: 0; margin-bottom: 0"><font class="content"><b><font size="2" color="#000000" face="Arial">home&nbsp;&nbsp;&nbsp;&nbsp;
about us&nbsp;&nbsp;&nbsp;&nbsp; treatment&nbsp;&nbsp;&nbsp;&nbsp;
training&nbsp;&nbsp;&nbsp;&nbsp; research&nbsp;&nbsp;&nbsp;&nbsp;
press room&nbsp;&nbsp;&nbsp;&nbsp; case&nbsp;histories&nbsp;&nbsp;&nbsp;&nbsp;
contact&nbsp;&nbsp;&nbsp;&nbsp; faq&nbsp; &nbsp;&nbsp;&nbsp;...more</font></b></font>
</td>
<td width="190" valign="middle" align="center" height="35">
<div align="center">
<table bgcolor="#4D7495" width="183" height="17">
<tr>
<td width="175" height="17">
<p style="margin-top: 0; margin-bottom: 0" align="center"><font face="Arial"><input TYPE="text" name="q" size="18" maxlength="255" value="Search our site" style="font-size: 8pt">&nbsp;<input type="submit" name="btnG" VALUE="Go" style="font-size: 8pt"></font></p>
</td>
</tr>
</table>
</div>
</td>
<td width="48" valign="middle" align="center" height="35">
<font face="Arial">
<img border="0" src="images/nhs_approved3_red.jpg" width="45" height="33">
</font>
</td>



*

jscheuer1
12-15-2009, 05:15 PM
The vAlign and align attributes should no longer be used for td elements. You can:


<style type="text/css">
td {
vertical-align: middle;
}
</style>

Or if there are only one or a few td elements that you want to do this to, create a class:


<style type="text/css">
.midaline {
vertical-align: middle;
}
</style>

Then in those td tags you want this to apply to:


<td class="midaline">

FYI: The css equivalent for the align attribute is text-align. For vAlign it's vertical-align.

biomike
12-15-2009, 07:09 PM
thanks for your help once again.

Michael