Why are my buttons not maintaining their positions correctly when the window is resized? I thought it should work as intended.
In my previous inquiry, I was able to successfully position elements for window resizing (CSS Top Relative To Screen). However, using two divs seems to be causing issues.
html, body {
margin: 0;
}
.Div1 {
background-image: url("https://imgur.com/7NQ3IOt.jpg");
background-size: 100% 100%;
background-repeat: no-repeat;
position: relative;
height: 76.1vw;
}
.Div2 {
background-image: url("https://imgur.com/CjVMSqG.jpg");
background-size: 100% 100%;
background-repeat: no-repeat;
position: relative;
height: 169vw;
}
.Btns {
position: absolute;
font-size: 2.1vw;
left: 16.5vw;
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="Div1">
<button class="Btns" style="margin-top: 4.8%">Button 1</button>
</div>
<div class="Div2">
<button class="Btns" style="margin-top: 4%">Button 2</button>
</div>
</body>
</html>