HTML Basics

HTML Introduction HTML Basic HTML Comments HTML Tags/Elements HTML Attributes HTML Formatting HTML Block and Inline HTML Charsets HTML Classes HTML Colors HTML Div HTML Headings HTML Id HTML Iframes HTML Images HTML File Paths HTML Tables HTML Layout HTML Lists HTML Links <a> HTML Paragraphs HTML Quotations HTML JavaScript HTML Emojis HTML URL Encode HTML Entities HTML Computercode HTML Symbols HTML Styles

HTML Forms

HTML Forms HTML Form Elements HTML Form Attributes HTML Input Attributes HTML Input Regex HTML Input Form Attributes HTML Input Types

HTML SEO

HTML Head HTML Page Title HTML Responsive HTML Semantics HTML Favicon

HTML Graphics

HTML Canvas HTML SVG

HTML Media

HTML Media HTML Audio HTML Video

HTML Reference

a abbr acronym address applet area article aside audio b base basefont bdi bdo big blockquote body br button canvas caption center cite code col colgroup data datalist dd del details dfn dialog dir div dl DOCTYPE dt em embed fieldset figcaption figure font footer form frame frameset h1_-_h6 head header hgroup hr html i iframe img input ins kbd label legend li link main map mark menu meta meter nav noframes noscript object ol optgroup option output p param picture pre progress q rp rt ruby s samp script search section select small source span strike strong style sub summary sup svg table tbody td template textarea tfoot th thead time title tr track tt u ul var video wbr

Tag <button> Tutorial

The <button> tag in HTML is used to create clickable buttons on a webpage. Buttons are used to submit forms, trigger JavaScript functions, and perform various other interactive actions.

Usage

To create a button, simply use the <button> tag with the text or content you want to display on the button inside the opening and closing tags. For example:

<button>Click Me</button>

This will create a button with the text "Click Me".

Main Attributes

Below is a table of the main attributes of the <button> tag and their uses:

Attribute Description
type Specifies the type of the button (e.g. "submit", "reset", "button").
name Specifies the name of the button (used when submitting a form).
value Specifies the initial value of the button.
disabled Specifies whether the button should be disabled or not.
onclick Specifies a JavaScript function to be executed when the button is clicked.

Examples

Here are some examples of using the <button> tag with different attributes:


<button type="submit" name="submitBtn" value="Submit">Submit</button>
<button type="button" onclick="alert('Hello!')">Click Me</button>
<button disabled>Disabled Button</button>