Elements, Tags, and Attributes

An HTML element usually consists of an opening tag, content, and a closing tag. Attributes provide additional information about an element. For example, <a href="/about">About</a> contains an anchor element with an href attribute. Some elements are void elements, meaning they do not have closing tags, such as <img>, <br>, <hr>, <input>, and <meta>.

Elements and Attributes
<a href="https://example.com" target="_blank">Visit Example</a>\n<img src="profile.jpg" alt="Profile photo">
💡 The anchor uses href and target attributes. The image uses src to identify its resource and alt to provide alternative text.
Key Takeaways
  • Tags are syntax used to create HTML elements.
  • Attributes configure or provide metadata for elements.
Knowledge Check

Which is a void HTML element?