1.container {
2 width: 200px;
3 height: 120px;
4}
5
6/* Resize images */
7.container img {
8 width: 100%;
9 height: auto;
10}
11
1<!--
2Resize image using html
3
4When we add any image in 'src' attribute of 'img' tag then image appears with original size on webpage
5and if we want to resize the image we have to add extra attribute i.e. height and width to img tag to resize the image
6-->
7
8Simple img tag
9<img src="image_path" alt="Image Sample">
10
11With height and width attribute
12<img src="image_path" width="200" height="40" alt="Image Sample">
13
14<!--
15I hope it will help you.
16Namaste
17Stay Home Stay Safe
18-->
1squareImage {
2 border: 1px solid #ddd; /* thickness and color of border */
3 border-radius: 4px; /* edge rounding of border */
4 width: 150px; /* width of image (px or % or auto) */
5 height: auto; /* height of image (px or % or auto) */
6}
1/*Search Term: "CSS change image width"*/
2
3img {
4 width: /*Add width here*/;
5}
6
7/*Example*/
8img {
9 width: 200px;
10}
1.container {
2 width: 50%;
3 height: 200px;
4 overflow: hidden;
5}
6
7.container img {
8 max-width: 100%;
9 height: auto;
10 display: block;
11}