Using Anchor (<a>) and (<img>) Tags

The Anchor Tag (<a>)

The anchor tag, written as '<a>' and closed with '</a>', Creates hyperlinks in uour webpage. Clicking on text or an image wrapped in this tag leads you to the linked destination (another wepage, email address, etc.).

The key attribute is href (Hypertext Reference), specifying the address (URL) of the linked resource

Absolute vs. Relative URLs

The Image Tag (<img>)

The image tag, written as the '<img>' (standalone tag, no closing tag needed), Inserts an image using the src attribute (source_ for the image location *absoulute or relative URL).

The 'alt' Attribute

The 'alt' attribute provides alternative text for the image. Always include a descriptive 'alt' text for your images!


Putting it all Together

This is an image of the moon linked to [Pics for learning])https://pics4learning.com/) using an absolute URL:

Image of a moon rock

This is an image of the Google logo linked using a relative URL.

Google Logo