CSS Portal

HTML <button> Tag

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

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

<button onclick="alert('Button clicked!')">
Click Me!
</button>

Attributes

name
Specifies the name for a button.
value
Specifies the underlying value of a button.
type
Specifies the type of a button.
Possible Values:
  • button
  • reset
  • submit

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
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 26th December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!