Help with adding text over images in html.

  • Thread starter Thread starter Stinger3
  • 8 comments
  • 679 views
Messages
8
Can anybody help me with this. When I try to add text to an html file with an image its either beside it, above it, or below it, and I want it to be over the image like its floating so that the image is in the background and the text is over it . I hope this explains my problem. I know <p> and </p> is the code to add a paragraph.
 
You have to use CSS. In the head portion of your document, add the following code:
Code:
<style type="text/css">
    p { position: absolute; top: -20px; left: 20px; }
</style>
Something like that (change the values to whatever you need).
 
The n00b way i do it, is to make a table, and set the image you want as the background image. That way you can add whatever you want above the image, even another image. Not sure of the code though, i usually just let dreamweaver handle everything :lol:
 
Jon.
The n00b way i do it, is to make a table, and set the image you want as the background image. That way you can add whatever you want above the image, even another image. Not sure of the code though, i usually just let dreamweaver handle everything :lol:

That's what i do, i still haven't moved on from table-based design.

<table cellpadding="0" cellspacing="0">
<tr><td width="imagewidth" height="imageheight" style="background-image:url(image.jpg);background-repeat:no-repeat;">Text goes here init</td></tr>
</table>

Biggest problem with this is that you still have to use CSS to position the text within the cell.
 
Back