🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Expert Masterclasses.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEhtml

html Documentation

LOADING ENGINE...

HTML Button Tag

Master the HTML button tag: Attributes, types, and accessibility.

button.html
<!-- Interaction -->
<button
type="submit"
>
Send <strong>Now</strong>
</button>
🔘
button.html
1 / 12
🔘

Tutor:The <button> tag is the primary way to create clickable elements in HTML. Unlike links which take you somewhere, buttons usually perform an action: submit a form, open a menu, or toggle a setting.


Interaction Mastery

Unlock nodes by learning button attributes.

Concept 1: The Tag

The <button> element is used for clickable actions. It must have a closing tag.

System Check

Is the button tag a void element?


Community Holo-Net

Button Designs

Created a cool button style? Share your CSS and HTML combinations.

Enjoying this guide?

Codesyllabus is 100% free and open-source. Support our mission, pay for server infrastructure, and fuel new tutorials by buying us a coffee!

The Power of the Button Tag

Author

Pascual Vila

Frontend Instructor.

The <button> element is the interactive core of web applications. While links navigate you to new pages, buttons trigger actions within the current context.

Types Matter

The most common mistake is forgetting the type attribute.

  • type="submit": The default behavior. Submits form data.
  • type="button": Does nothing by default. Used for JavaScript interaction.
  • type="reset": Clears all inputs in a form (use carefully!).

Accessibility

Native buttons come with built-in accessibility. They are focusable via keyboard (Tab key) and can be activated with Enter or Space. If you use a <div> instead, you break this functionality for screen reader users.

States

Buttons have states like :hover, :focus, and :disabled. The disabled attribute specifically removes the element from the tab order and prevents click events.

Button Glossary

type="submit"
The default behavior for buttons inside a form. It gathers form data and sends it to the server URL defined in the form's action.
type="button"
A button with no default behavior. It will not submit a form. It is purely for triggering JavaScript events.
disabled
A boolean attribute that makes the button non-interactive and unclickable, often displayed with a grayed-out visual style.
autofocus
An attribute that automatically gives focus to the button when the page loads.