Lesson 3 of 3
Elements and Attributes
Choose elements for meaning and use attributes to supply necessary context.
An element represents part of the document. Attributes configure that element or provide information that cannot be expressed by its text content alone.
<a href="/projects" aria-label="Explore BuildWithVikesh projects">
Explore projects
</a>Choose by purpose
- Use a button for an action and a link for navigation.
- Give images useful alternative text when they communicate information.
- Associate every form input with a visible label.
- Use native elements before recreating their behavior with ARIA and JavaScript.
Semantic HTML is not extra polish. It is the interface contract underneath the visual design.