3. Attributes
HTML attributes provide extra information about an element and are written inside the opening tag.
They usually come in name-value pairs, where the name is the attribute and the value is what it’s set to. Attributes are used to change behaviour, add links, or give elements identifiers for styling and scripting.
For example, the href attribute is used in an anchor tag to define where a link goes:
1 | |
In this case, href="https://example.com" tells the browser that clicking the link should take the user to the https://example.com website.