1css:
2.example-class {
3 width: 400px;
4 height: auto;
5}
6
7html:
8<img class="example-class" src="example.jpg"/>
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.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}