HTML <button> Tag
Description
The <button> HTML element defines a clickable interface element that users can interact with to perform actions on a webpage. Unlike simple links, buttons can trigger a wide range of behaviors, such as submitting forms, executing JavaScript functions, toggling content visibility, or controlling interactive components like modals and menus.
A key advantage of <button> over other clickable elements, like <a> or <input type="button">, is its flexibility: it can contain not just text, but also images, icons, or even complex HTML content, allowing developers to create visually rich and interactive controls. Buttons are also accessible by default - they can be focused and activated using the keyboard, making them an essential part of building user-friendly and inclusive web interfaces.
Because <button> elements are versatile, they are widely used in forms, navigation, toolbars, and interactive widgets, serving as a core building block for modern web applications.
Example:
<button onclick="alert('Button clicked!')">
<img src="icon.png" alt="Icon"> Click Me
</button>
This example shows that a button can combine an image and text, creating a richer user experience.
Properties
- Permitted Parents
- Any element that accepts phrasing content
- Content
- Any block, inline and text
- Start/End Tags
- Start tag: required, End tag: required
Example
Attributes
Global Attributes
The <button> tag also supports the Global Attributes in HTML5
Event Attributes
The <button> tag also supports the Event Attributes in HTML5
Browser Support
The following information will show you the current browser support for the HTML <button> tag. Hover over a browser icon to see the version that first introduced support for this HTML tag.
This tag is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 26th December 2025
