To achieve the desired layout, I am trying to adjust the negative margin for the .text
div so that it aligns on top of the .image
div.
<div class="wrap">
<div class="image"><img src="imgage.jpg" /></div>
<div class="text">text with background</div>
</div>
.image {
overflow: hidden;
}
.text{
background: green;
padding: 20px;
margin-top: -60px;
color: #FFFFFF;
overflow: hidden;
}
Despite setting the background for the .text
, it does not display over the image as intended. Currently, only the text is visible in the given setup. You can view the issue here: http://jsfiddle.net/ovkn4egc/
I am seeking solutions to resolve this problem without resorting to using absolute positioning. Thank you.