How to resize image according from screen resolution on html css


Tags: html,css,image,screen-resolution

Problem :

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% }

    CSS Howto..

    PHP How to not cache generated HTML but cache static data like images/js/css

    How to make a div next to each other in CSS

    How to center CSS-shapes within a wrapper in a row

    How to remove borders around a div (nav, footer, whatsoever) in a WordPress theme? [closed]

    How to keep nav menu highlighted after click using js in sidebar

    how to clip text in css like gmail does to emails subject listings

    Some doubts about how make an image clickable using CSS

    How do I remove the side padding in the following case?

    How to have different alignments in one div(nav)?

    CSS: How to make this kind layout?

    How do I center the contents in this div?

    how to draw a configurable pie chart in css

    In javascript, jQuery, or css how do I get a div or iframe to expand to fill rest of space

    How to test a webpage for different aspect ratios

    how is possible to change not nested elements attribute with css?

    How to completely show hide tabs on onclick event in HTML CSS Javascript

    In CSS, how to make the colored background be at least 50% of pagewidth and at most 90%, and as wide as necessary?

    How to generate a source map for minified CSS generated by dotless

    How to read inline styling of an element?

    How to dynamically modify