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

vertical centre text to an image

Status
Not open for further replies.

brisray

Programmer
Feb 7, 2002
88
US
Using CSS, is it possible to vertically align centrally text to an image as you can using tables?

A simple example using a table would be

<table border="0" width="100%">
<tr>
<td><img border="0" src="image.gif" width="609"height="115"></td>
<td valign="middle">Ray did this</td>
</tr>
</table>

Using CSS so far I've got...

<p><img class="imglft" border="0" src="img.jpg" width="434" height="400" alt="my image">Ray did this>

The CSS for imglft is...

.imglft{
float: left;
margin-right: 30px;

}

I've tried putting the whole lot in a DIV and using text-align: middle and vertical-align: middle but that doesn't work.

You can see what I mean by comparing or with or
Ray
 
CSS:
.imglft {
float: left;
margin-right: 30px;
vertical-align: middle;
}
 
Thanks for the reply, but I've tried that and it isn't a solution.

Ray
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top