Text over image problem

G

Graham S

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?
 
J

Jukka K. Korpela

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top