HTML <button> tag
- closing tag
- required
- void element
- no
- lives inside
- <body>, often inside <form>
- typically holds
- button label text
Where it goes
Anywhere something needs to be clicked. Inside a <form>, a button sends the form when clicked, unless you tell it not to.
Example
<button>Click me</button>Open this example in the editor →
Common mistakes
- Styling an <a> to look like a button when it does not go anywhere. A real action belongs on a real <button>.
- Forgetting that inside a <form> it sends the form by default. A "cancel" or "show more" button needs type="button", or every click submits.
- Making it an icon with no text. A screen reader (software that reads the page aloud) announces an empty button. Give it text, or an aria-label.