I have an image that gets resized/rescaled when I scale the window. I am now adding a button to it. I want the button's position to be fixed onto the image when I resize the window.
Maybe I am doing it completely wrong with the button. What is the right way to position the button that stays fixed to the image while resizing?
html,
body {
background-color: #000028;
height: 100%;
margin: 0;
padding: 0;
}
img {
padding: 0;
display: block;
margin: 0 auto;
max-height: 100%;
max-width: 100%;
}
.button {
position: fixed;
left: 100vh;
top: 0;
bottom: 0;
right: 0;
margin: auto;
height: 10%;
width: 10%;
overflow: hidden;
z-index: 2;
display: block;
}
<img src="https://images.unsplash.com/photo-1606228281437-dc226988dc3a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80" />
<input type="image" class="button submit" src="https://i.picsum.photos/id/95/200/300.jpg?hmac=XW2T1mpTuATtTLyDvkvdQqgh2nodO9Zudo3dH2aXCBA" alt="submit" />