...

View Full Version : Align right + Valign top



JAVAEOC
02-03-2004, 06:50 PM
if i align my image right it also puts it on the top of the cell but how can i have 50%over the image and 50% under it meaning it is right in the middle of the cell?

Roy Sinclair
02-03-2004, 07:45 PM
CSS

{vertical-align: middle; }

JAVAEOC
02-03-2004, 11:29 PM
but this doesnt work in a table cell :(

Roy Sinclair
02-04-2004, 04:10 PM
Originally posted by JAVAEOC
but this doesnt work in a table cell :(

Yes it does.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Testing</title>
<style type="text/css">
td { border: solid blue 2px; }
#row1 { height: 400px; }
#row1cell1 { vertical-align: middle; }
</style>
</head>
<body>
<table id="myTable" summary="">
<tr id="row1">
<td id="row1cell1">
<img src="sample.gif" alt="" />
</td>
<td id="row1cell2">
Just some text
</td>
</tr>
<tr id="row2">
<td id="row2cell1">
more text
</td>
<td id="row2cell2">
and the last bit of text
</td>
</tr>
</table>
</body>
</html>


Tested in IE 6 and Moz 1.4 - worked in both.

JAVAEOC
02-04-2004, 11:07 PM
oh i put the valign tag on the image :)
doh



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum