In HTML 4.01, the height could be defined in pixels or in % of the containing element. The key is to use height:auto to override any height=”…” attribute already present on the image. Tested on Opera 9.25, IE 7.0, and Firefox 2.0 The resize property will not work if width and height of image defined in the HTML. it won't increase in size to fit the container). The size of your image is counted as 100%. If you set both to "100%", the image will be stretched. Save Your Code. In HTML5, the value must be in pixels. Working Around The Problem. Syntax: img { max-width:100%; height:auto; } Width can also be used instead of max-width if desired. If you click the save button, your code will be saved, and you get a URL you can share with others. First table is only 100 pixel width in any changes in browser window state, while other table will always stretch the full width of the window it is viewed in, that is the table automatically expands as the user changes the window size when you set width in % . However, if the image is smaller than its container, it will be displayed at its true size (i.e. To reduce the image size in pixels, for example, by 20%, type 80, and to enlarge by 20% enter 120. The width and height attributes in HTML specify the size of an image in pixels. But The percentage setting does not take into account the original image size. This will decrease the picture's height and width to 20% of the original size, but the picture might look a bit jerky, because browsers usually don't do any kind of anti-alising or image resampling. From w3schools :. To reduce image 2 times enter 50 and to enlarge 2 times - set 200. You can use percent for layout, but this can require more work. Select a picture on your computer or phone, specify size in percent and then click OK. Other settings are installed by default. The max-height property sets the maximum height of an element, and the max-width property sets the maximum width of an element. By ommitting any width/height declarations and only using max-width: 100%;, the image will be displayed at 100% of the size of its container, but no larger.If the image is larger than its container, the image will shrink to fit. This wikiHow teaches you how to specify the size of an image in your HTML code. The limitations for responsive images have been known for a long time and many workarounds, including the so-called padding-bottom hack, have been created to work around the issue.This uses the fact that padding percentages (including padding-bottom) are always based on the container width (to ensure a consistent padding even if height and width differ). The