i want to put text into an image using css.

i saw a few codes that tell you to put div inside a div.
make one div relative and the other absolute.

the problems that i have is that i already have a relative div outside the picture.

can anyone help?

Recommended Answers

All 4 Replies

just create 2 divs, like this:

<div id="image">
 <div id="text">
  Some Text
 </div>
</div>

set the background of div#image to your image file:

#image {background: URL('image.png');}

and then you have the text inside the image.
there is no need to use relative or absolute positions

commented: Thank you +0

awesome ... thanks. how do i stop it from repeating?

i put this..:
#image {background-image:url(Ebay/Images/EbayLogo.gif); background-repeat:no-repeat}


but it keeps repeating

#image {background: URL('Ebay/Images/EbayLogo.gif') no-repeat;}

just try it like this :)

If you have a jpg,png or other such image and you want to add some text to it, then you can simply create a div with the following css.

.txtdiv
{
position:absolute;
left:100px;
top:500px;
}

Don't forget to adjust the pixel values for left and top so that it would be placed on the desired part of the image.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.