I am looking to create a div with text inside it. Within that div, I also want another div that matches the same position and size. I have searched on various forums for a solution, but none of them seem to work when even a small detail is different.
Currently, I am unable to see the text on the page. Why is that? I would prefer a solution that does not impact the CSS for the '#container'.
Here is the HTML code:
<div id="container">
<p>Some text that is messing with me</p>
<div class="background-img"></div>
</div>
And here is the CSS code:
#container {
position: fixed;
left: 10px;
top: 30px;
width: 100px;
height: 50px;
background: red;
}
p {
color: blue;
}
.background-img {
position: absolute;
background-size: cover;
background-repeat: none;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: url(http://lorempixel.com/420/255);
}
For more information, please visit the following link: https://jsfiddle.net/clankill3r/8kaLj2su/