I would like to make a div child element as overlay for all the parent content,with parent width fixed. (an example could be the js captions you see on photo galleries usually)
HTML:
<div class="parent">
<div class="child">child</div>
<div class="overlay">overlay them</div>
</div>
CSS:
.parent{
width:300px;
max-width:300px;
}
.child{
width:100%;
min-width:100%;
position:relative;
}
.overlay{
position: /*?? to make it cover like overlay all the .child so all the .parent content*/
}
jsfiddle: http://jsfiddle.net/ttUgM/1/
Try giving the
.parentaposition:relativeand the.overlayaposition:absolutethis will allow you to position the.overlayrelative to the.parent. Is that what you want?