1 Minute HTML CSS Part 12 – Images

INSERTING IMAGES

<img src="MY-IMAGE.JPG" title="Image Title">
  • <img> Image tag.
  • src Image source file.
  • title Optional, the image title. Shows on mouse hover and when the image fails to load.

 

WIDTH & HEIGHT

  • By default – Images will only be inserted into the page when it loads. This will cause the content to be pushed downwards and a visible layout shift.
  • To “fix” this problem, simply set width and height of the image.
  • This way, the browser reserves a space for the image while it loads. No layout shift will happen.