Example

A simple <button>:

Laboratory

description & Usage

<button> defines a clickable button.

The most important attribute of this tag is the type attri bute which tells browsers the type and function of the button. This attribute is not required.

Acceptable values for the type attribute include reset , sumbit , button. For more information about this attribute, please refer to the type attribute page.

<button> can contain text and formatting tags like <b>, <i>, <strong>... as well as content tags like <img>.

Browser compatibility and Support

# Chrome Edge Firefox Safari Opera
<button>

Attributes

Attributes Values Description
autofocus
autofocus
Determines whether the corresponding tags on the right side get focus when the page is opened.
disabled
disabled
It is used to disable the corresponding elements on the right side.
form
form-id
It is used to disable the corresponding elements on the right side.
formaction
URL
It determines the place to send information inside <form> (this feature is only used for "sending").
popovertargetaction
element-id
Specifies what happens to the popover when the button is clicked.
name
name
Specifies the name of the tag.
type
button-reset-toggle
Determines the type of the corresponding tags on the page.
value
text
Specifies the value of the corresponding tags in the side.

Global Attributes

The <button> tag supports the HTML Global Attributes.

Event Attributes

The <button> tag supports the HTML Event Attributes.

Default CSS

Most browsers will display the <button> tag with the following default style: