Loading…
Everything will be ready in few seconds
- Theory
- Theory
- Comments
Image dimensions
We learned about the basic image formats, but Muffin again sent us some corrections. When he tried to read our entry, some of the images did not fit on the screen of his monitor, and some were hard to see. This is because we forgot to think about the image dimensions.
In HTML, you must use the width
and height
attributes in order to control image width and height. The dimensions are specified without units in px
in these attributes. For example:
<img src="logo.png" width="200" height="100">
In the example above, the image has been assigned a width of 200px and a height of 100px.
If you specify only one of the dimensions, whether width or height, then the browser will calculate the second dimension independently based on the image proportions.
By the way, you need to be very careful when working with image height and width: if you specify both the height and the width at the same time, then the browser may display the image disproportionally.
- day-14.html
- style.css
Thanks! We’ll fix everything at once!
The code has changed, click “Refresh” or turn autorun on.
You’ve gone to a different page
Click inside the mini-browser to shift the focus onto this window.
Comments