I am currently working on creating a layout with three divs, each containing an image. The challenge is to set the height of the first div (top) to 10% of the screen size, the second (middle) to 60%, and the third (bottom) to 30%. I want these divs to maintain their full size without resizing.
Here is my current code:
#right
{
display: block;
float: left;
margin-left: 81%;
width: 19%;
height: 100%;
}
.logo
{
top-margin: 0%;
height: 10%;
width: 100%;
}
.MiddleRight
{
top-margin: 10%;
width: 100%;
max-height: 60%;
height: 100%;
}
.footer
{
top-margin: 80%;
height: 30%;
width: 100%;
}
img
{
position: absolute;
}
(#right is the main container where logo represents the first div, MiddleRight the second, and footer the third. I will rename them later but for now, I just want it to work).
And here is the HTML snippet:
<div id="right">
<div class="logo">
<img src="logo.png" style="max-width: 100%; max-height: 100%; position: relative;"</img>
</div>
<div class="MiddleRight">
<img src="middle.PNG" style="max-width: 100%; max-height: 100%; position: relative;"</img>
</div>
<div class="footer">
<img src="footer.png" style="max-width: 100%; max-height: 100%; position: relative;"</img>
</div>
</div>
I am still new to HTML/CSS and struggling to figure out what's causing the issue. Can someone assist me?
EDIT [Issue Resolved]: Here's a solution that worked: CSS :
html, body {
margin: 0;
height: 100%;
width: 100%;
}
#right {
display: block;
float: left;
margin-left: 81%;
width: 19%;
height: 100%;
}
.logo {
height: 10%;
background: red;
}
.MiddleRight {
height: 60%;
background: blue;
}
.footer {
height: 30%;
background: green;
}
#right img {
max-width: 100%;
max-height: 100%;
position: relative;
}
HTML :
<div id="right">
<div class="logo">
<img src="logo.png" style="width: 100%; height: 100%;">
</div>
<div class="MiddleRight">
<img src="middle.PNG" style="width: 100%; height: 100%;">
</div>
<div class="footer">
<img src="footer.png" style="width: 100%; height: 100%;">
</div>
</div>