I am facing an issue with the following piece of code:
<body>
<div class="page-top">
*
</div>
<div class="page-bottom">
<div class="contentbox">
<h1>CONTENTBOX</h1>
</div>
</div>
</body>
Here is the corresponding stylesheet:
body {
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin-bottom: 0;
}
div.page-top {
padding-bottom: 20%;
}
div.page-bottom {
padding-bottom: 80%;
background-image: url('http://hd.wallpaperswide.com/thumbs/fog_at_the_pink_house-t2.jpg');
}
div.contentbox {
background-color: red;
margin-top: 10%; <!PROBLEM>
}
The problem arises when I add a top margin to the contentbox
as described in the code snippet. Instead of positioning the div just ten percent below the top line of the 'parent' div (.page-bottom
), it creates empty space above both divs.
My goal is to have the content div with a margin of approximately 20% on all sides, making it a smaller div (contentbox
) within a fullscreen div (page-bottom
).
For clarification: click here for the image
Thank you for your assistance, and feel free to ask for more information if needed!