Image In Html Height And Width. Always specify both the height and width attributes for images. Setting height width in html.

This wikihow teaches you how to specify the size of an image in your html code. Setting height width in html. If you set both to 100 the image will be stretched.
Consider the example above the css width is set to 100 and the height is set to auto.
In the next example we use the max width and max height properties. The problem is that unless you were giving explicit width and height css values to your images and who wants to limit themselves like that in a responsive world where you want the image to expand or shrink to fill up the available space then css will need the dimensions from the image file itself to figure out the auto part of the dimensions. In the absence of a width and height attribute it doesn t. The max height property sets the maximum height of an element and the max width property sets the maximum width of an element.