I am seeking assistance on how to resize an image to fit the width of the browser. Specifically, the image I want to resize is my header image and I want it to span the entire screen width.
Additionally, I need to overlay a div on top of the image. Currently, I have tried the following code but it doesn't seem to work.
#container {
position: relative;
}
#divWithin {
position: relative;
top: 20%;
left: 20%;
padding: 5px;
background-color: white;
}
#imgWithin{
width: 100vw;
height: 100vh;
left: 0;
}
<div id="container">
<img id="imgWithin" src="~/images/image(2).png" style="height:325px; margin-top: 75px;" />
<div id="divWithin">Testing</div>
</div>
Any advice or suggestions would be greatly appreciated.
The desired outcome is illustrated in the image below:
https://i.sstatic.net/XMJAp.png
Where 1 represents the image spanning the width of the screen, and 2 represents the div overlaying the image.