Images and Links

Inserting Images

<img src="image.jpg" alt="Image description" width="300">
  • src: Path to the image file.
  • alt: Alternative text for accessibility and SEO.
  • width and height: Define the size of the image.
<a href="https://www.example.com">Visit website</a>
  • href: The address the link points to.
<a href="#section1">Go to Section 1</a>

Best Practices

  • Always include the alt attribute for images.
  • Use relative paths for internal resources.

Exercise

Create an HTML document that displays an image with a link that directs to an external website.