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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why can't I get it to vertically align my text?

Status
Not open for further replies.

JRBeltman

IS-IT--Management
Feb 5, 2004
290
NL
Hi All,
maybe a bit of a stupid question,
but how do I get the text in the first 4 table rows to be vertically aligned?

I have tried div and valign="middle" align="center", but no succes on this table. Funny enough they do work in my test files.

By the way this script is partly written in PhP.

Code:
    <table border=1>
      <colgroup>
        <col width="200">
        <col width="200">
        <col width="100">
      </colgroup>

      <tr>
	<td>Surname</div</td>
	<td><?=$contact['surname']?></td>
	<td rowspan=4 align='right'>
	<?
	echo "<img src=\"resize_image.php?image=contact/"
	  .$contact['id'].".jpg\" align=center>";	
	?>
	</td>
      </tr>
      <tr>
	<td>Forename</td>
	<td><?=$contact['forename']?></td>
      </tr>
      <tr>
	<td>Date of Birth</td>
	<td><?=$contact['dateofbirth']?></td>
      </tr>
      <tr>
	<td>Nationality</td>
	<td><?=$contact['nationality']?></td>
      </tr>

      <tr>
	<td>Studies</td>
	<td colspan=2><?=$contact['studies']?></td>
      </tr>
      <tr>
	<td>ELSA CV</td>
	<td colspan=2><?=$contact['elsa']?></td>
      </tr>
      <tr>
	<td>What does my ELSA-Function involve?</td>
	<td colspan=2><?=$contact['function']?></td>
      </tr>
    </table>

JR
(In need of a cool signature)
 
If you want the text to be vertically aligned, try adding a style="vertical-align: middle" to the <TR> or <TD> elements that you wish to be vertically aligned. If your browser supports this CSS1 style property in tables (Netscape 4.0+ doesn't), it should work.

P.S. Your tags are closing improperly (unless you forgot to delete the </div). On the ninth line in your message (Surname), you have <td>Surname</div</td>.
It should read (if you are using <DIV>):

<td><div>Surname</div></td>

(if you are not using <DIV>):

<td>Surname</td>

I think you can put the style="vertical...." in the <DIV>, <TR>, and <TD> tags. Just choose one!
 
Thanks a lot. I dont know what I missed out before, but think I can't spell (middel instead of middle)

Thanks again

JR
(In need of a cool signature)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top