HTML Button Generator
Generate copy-ready HTML locally in your browser.
Generate copy-ready HTML locally in your browser.
The HTML <button> element creates a clickable control that is focusable, activatable with the keyboard (Enter or Space), and announced to screen readers as a button by default — none of which a styled <div> or <span> gets without extra ARIA work. Inside a <form>, its type attribute controls behavior: submit (the default) submits the form, reset clears it, and button does nothing on its own — it's meant for actions you wire up in JavaScript, like opening a menu, toggling a panel, or running a calculation.
<button type="button"> wrapping that text.type attribute to submit if it belongs inside a form.<button type="button">Add to cart</button>Inside a form, a button with no type (or type="submit") submits the form on click. type="button" opts out so you can attach your own handler without triggering an accidental submit.
<button> can contain other markup — icons, spans, line breaks — while <input> only shows plain text from its value attribute. Both submit a form identically as type="submit".
Not without extra work — it isn't in the tab order and isn't announced as a button unless you add tabindex="0", role="button", and your own keydown handling. <button> provides all of that natively.
Add the disabled attribute. It's removed from the tab order, shown dimmed by default, and stops firing click events entirely — even to JavaScript — so a temporary "loading" state is often better handled with aria-busy and a visual style instead.