An HTML element is one component of an HTML document, usually written as an opening tag, content and a closing tag, for example <p>Hello</p>. The browser turns each element into a node in the DOM.
Why it matters
Elements define structure and meaning, which drives styling, scripting, accessibility and search engine understanding. Picking the right element gives you built-in behavior for free: a <button> is focusable and keyboard-operable, while a styled <div> is not.
Some elements are void and have no content or closing tag, such as <img>, <br> and <input>.
Example
<a href="/pricing" class="cta">See pricing</a>
Here a is the element name, href and class are attributes, and "See pricing" is the content. The whole thing is one element, while the <a> and </a> parts are its tags.
Common mistakes
- Using tag and element interchangeably. Tags are the markup; the element is the whole thing including content.
- Nesting incorrectly, such as a block element inside a paragraph, which browsers silently repair in surprising ways.
- Using generic divs where a semantic element exists.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.