HTML Elements

Buttons

Buttons that represents an action can be created using the HTML <button> tag. We can use buttons to submit forms, signal clickable actions and attach JavaScript triggers.

Common attributes

We usually leave button attributes to their default values, but sometimes it can be useful to disable them or give them a submit or reset type attribute when used in forms.

AttributeDescriptionRequired
disabledwhether the button should be disabledno
typetype of the button (button, submit or reset)no (defaults to regular button in most cases, but will default to submit button in forms)

Code example

<button>
Download game
</div>

has the potential of producing the button below (given some styling)

Accessibility

Make buttons as large as your design allows and put sufficient space between them.

Navigation should in general be done through anchor elements, but buttons can be used if the target location is on the same page.

Read more on MDN

<button>: The Button element

Test yourself

Description

Add a submit type disabled button with the text

Register

as the last element in the form.

Tests

  1. 1 You should create a button.
  2. 2 Your button element should have a closing tag.
  3. 3 Your button element should have the type specified in the description.
  4. 4 Your button element should have the text specified in the description.
  5. 5 Your button element should be disabled.
Editor
Preview