August 29, 200917 yr Is it possible to overlap html text onto an image? If so how is it done? I have been agonising over this for a few hours and tried all different types of code, nothing works!
August 29, 200917 yr Make a div, put the background of the div as the image. (Make sure you set the divs height and width the same as the images!) Then put the text you want in the div. Like so... <style type="text/css"> #image1 { background-image: url('imageurl.png'); width: 100px; height: 100px; } </style> <div id="image1"> Hello </div> I hope that helps.
August 29, 200917 yr Author It works!!! You’re a life saver! Been scratching my head over that all day! It was so simple; I thought you could only set a background image for the whole browser window and not individual divs. Well now I know. Thanks
August 29, 200917 yr Another way you could have approached it is relatively positioning a p tag with a specific class so for example: HTML: <div id="imageHolder"> <img src="blah.jpg" alt="blah"/> <p class="imageText">Image text</p> </div> CSS: .imageText { position: relative; top: 50px; left: 50px; } However, the method previously stated works aswell with the bonus of not having to mess with relative positioning.
August 30, 200917 yr nice one dt17 i like the second method as well. i knew about the background but positioning is something i enjoy messing around with so it's nice that you share the knowledge!
Create an account or sign in to comment