I have two divs inside a div,
HTML
<div class="preview">
<div class="gamePreview"></div>
<div class="gameName"></div>
</div>
I would like the gameName divs to be on top of the game Preview divs.
CSS
.preview {
display: block;
}
.gamePreview, .gameName {
margin-left: 20px;
}
.gamePreview {
width: 30%;
height: 350px;
margin-top: 40px;
background-color: lightgrey;
float: left;
}
.gameName {
width: 29.59%;
background-color: #494949;
height: 150px;
opacity: 0.5;
margin-top: 240px;
clear: both;
position: absolute;
}
This works fine when there is only one of the preview divs. However, if I wanted to put two divs on the same line, the gameName divs all float left on the same spot. Instead, I would like each gameName div to be on top of its own gamePreview div.
https://jsfiddle.net/r5t5vuqk/

