HTML Buttons

Article Summary

Learn how to use HTML buttons, button types, and attributes with simple and clear examples.

HTML buttons are used to trigger actions, such as submitting forms or running scripts.


Button Element

<button 
  type="button"
  id="action-btn"
  class="btn"
  title="Click action">
  Click Me
</button>

Attributes Used

  • type → button behavior (button, submit, reset)
  • id → unique identifier
  • class → styling or grouping
  • title → tooltip text

Button Types

<button type="submit">Submit</button>
<button type="reset">Reset</button>
<button type="button">Custom Action</button>

Important Notes

  • Buttons can contain text or icons
  • Use type="button" outside forms
  • Buttons work well with JavaScript
Was this helpful?