I have an image, and I want the width to fill up the browser window, no matter the size of the window.
How do I do this in HTML and CSS?
You add the following element in the head of your HTML document:
Then you add
max-width:100%;
height:auto;
as a CSS rule for both the image and the container of the image. (It can also work for the image without having a container.)
And you add
body {
margin: 0;
}
to get rid of the margin around the image and/or container. This is how your image will fill the whole width of the screen, no matter what size the screen is.