Results 1 to 3 of 3

Thread: help with middle alignment of cell in table

  1. #1
    Join Date
    Apr 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help with middle alignment of cell in table

    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>


    Code:
                        
    <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>
    *

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The vAlign and align attributes should no longer be used for td elements. You can:

    Code:
    <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:

    Code:
    <style type="text/css">
    .midaline {
    vertical-align: middle;
    }
    </style>
    Then in those td tags you want this to apply to:

    HTML Code:
    <td class="midaline">
    FYI: The css equivalent for the align attribute is text-align. For vAlign it's vertical-align.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks for your help once again.

    Michael

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •