Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Text over image problem

Reply
Thread Tools

Text over image problem

 
 
Graham S
Guest
Posts: n/a
 
      10-18-2012
I am displaying a small image in a table data cell of an HTML table and I
want to display between 1 and 3 letters over the center of this image. Any
clues on the CSS needed to achieve this?


 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      10-18-2012
2012-10-18 9:52, Graham S wrote:

> I am displaying a small image in a table data cell of an HTML table and I
> want to display between 1 and 3 letters over the center of this image. Any
> clues on the CSS needed to achieve this?


Wrap the text in a <span> element and both it and the <img> element in a
<div> element. Set position: relative on the <div> element and then
position the <img> and <span> absolutely inside it. It is simplest,
though not most flexible, to set the width and height of <div> the same
as those of the image and set display: block on <img> (to avoid extra
spacing).

--
Yucca, http://www.cs.tut.fi/~jkorpela/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VOIP over VPN over TCP over WAP over 3G Theo Markettos UK VOIP 2 02-14-2008 03:27 PM
IE bug (downloading the same image over and over) OBAFGKM_RNS@yahoo.com Javascript 5 04-17-2007 04:55 PM
Check Image is over another Image Varangian ASP .Net 9 04-05-2006 08:20 AM
Check Image is over another Image ofmars@gmail.com Javascript 0 03-31-2006 03:07 PM
Mouse-over an image -> play video instead of swap image? Phillip Roncoroni HTML 6 04-06-2004 06:57 AM



Advertisments