HTML5
HTML5

HTML Buttons

Buttons are controls that perform an action. The <button> element is the normal HTML way to create one. Inside a form, a button with type="submit" submits the form. A button with type="button" is a normal button that does not submit the form by itself. type="reset" can reset form controls to their initial values. A button is for an action. A link is for navigation. That difference is simple and important: use <a> when you are going somewhere, and <button> when you are doing something.

Why this matters

  • ·Buttons make actions clear.
  • ·Button types tell the browser what the action is.
  • ·Using buttons and links correctly improves accessibility and behavior.

Common mistakes

  • ·Using a link as a fake button can make behavior confusing.
  • ·Leaving a form button type unclear can cause accidental submissions.
  • ·Buttons should have clear text or an accessible name.
Your codeHTML
Live preview

Frequently asked questions

An action.

Practice questions

Question 1

Create a submit button.

Your codeHTML
Live preview

Question 2

Create a normal action button.

Your codeHTML
Live preview

Quick check

Just for this topic answer honestly, then check yourself.

1 / 3

Which element is for navigation?