I'm struggling to achieve the desired outcome with my layout:
https://i.stack.imgur.com/CvLFl.png
I have successfully replicated the image, but only when my div is not floating on the page (without margin applied and without using position: absolute
). Otherwise, the green rectangle is not visible.
Here is my HTML structure:
<div class="app">
<div class="interface">
<div class="view">
<div class="body">
<div class="top">
Top content
</div>
<div class="middle">
Middle content
</div>
<div class="bottom">
Bottom content
</div>
</div>
</div>
</div>
</div>
In the .interface
CSS, I have the following:
.interface
{
position: absolute;
top: 15%;
}
When using this CSS code, the green rectangle remains invisible. If I remove position: absolute
(and consequently, stop applying top: 15%
), I am able to see the green rectangle.
You can observe the issue in this JSFiddle: https://jsfiddle.net/v9euwdz3/
How can I ensure that the DIV is displayed at a specific level from the top without altering my HTML structure?