Search code examples
htmlcssimagescreen-resolution

How to resize image according from screen resolution on html css


I want to change an image so that its size is according to the screen resolution, for example 1920x1080 to 1600x900, using HTML and CSS.

How can I do it?


Solution

  • HTML :

    <div class="img-div">
    <img src="path-to-image">
    </div>
    

    CSS :

    .img-div { height:100%; width:100%;}
    img { max-width:100% }