Academy / Advanced Level: HTML and CSS

Accessibility and SEO Best Practices

Optimizing Images with Alt Text

Alt text (alternative text) is used to describe the content of an image, which is important for both accessibility and SEO. Screen readers rely on alt text to describe images to users who are visually impaired. Search engines also use alt text to understand what the image is about, making it a key factor for image SEO.

Best Practices for Alt Text:

  • Be descriptive but concise.
  • Use keywords naturally (for SEO), but don’t stuff keywords unnecessarily.
  • Avoid using phrases like "image of" or "picture of," as screen readers already convey that the element is an image.

Example of Good Alt Text:

<img src="laptop.jpg" alt="Person using a laptop to code a website">