Imagine you have some example HTML code like this:
HTML
<div id="container">
<div id="content">
<h1>Here is some content</h1>
<p>Description of the product.
More information about the product.</p>
</div>
</div>
CSS
#container
{
background-image:url('http://image.made-in-china.com/2f0j00cZjaqNvWlEks/Men-T-Shirt.jpg');
background-repeat:no-repeat;
height:400px;
width:400px;
}
#content
{
position:absolute;
height:auto;
width:auto;
top:150px;
left:100px;
}
#content h1
{
color:Yellow;
font-weight:bold;
font-size:22px;
}
#content p
{
color:Red;
}
You can add a background-image
to the main div
#container
, give the position of absolute
to the nested div
#content
, and then use top
and left
properties to adjust its position as needed.
See Live Demo
I hope this explanation is helpful.
Updated to set #container div's height and width to auto
Check out Updated Demo