HTML button Tag
The information on this page is based on HTML version 4.01 (which is the current version of HTML). The next version, HTML 5, is currently being written. Here's a list of HTML 5 tags.
The HTML button tag is used for creating a button within forms.
Although you can also use the <input> tag to create an HTML button, the <button> tag does have some advantages. In particular, you can place HTML between the <button></button> tags. This enables you to do things you wouldn't normally be able to with the <input> tag.
| Examples |
Example 1:
This HTML button was created using the following code:
<form>
<button name="quackitButton" value="Submit" type="button">Click Me</button>
</form>
Example 2:
This button, which also contains an image, was created with the following HTML code:
<form>
<button name="quackitButton" value="Submit" type="button">
<img src="/pix/web_graphics/free_website_graphics/icons/books/book13.gif" alt="Read book" />
<br />Read Book!</button>
</form>
|
| Attributes: |
| Attributes specific to this tag: |
| Attribute | Description |
| name | Assigns the name of the button control. |
| value | Assigns an initial value to the button. |
| type | Specifies the type of button. Possible values:- submit (default)
- reset
- button
|
| Other Attributes: |
| Attribute | Description |
| class | Document wide identifier. |
| id | Document wide identifier |
| lang | Language code |
| dir | Specifies the direction of the text |
| disabled | Disables the button. The button won't work when clicked. It also cannot receive focus and will be skipped when tabbing. |
| accesskey | Access keys (or shortcut keys) |
| tabindex | Helps determine the tabbing order (when the user 'tabs' through the elements on the page). |
| title | Specifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip"). |
| style | Inline style (CSS) |
| onfocus | Intrinsic event (see event handlers) |
| onblur | Intrinsic event (see event handlers) |
| onclick | Intrinsic event (see event handlers) |
| ondbclick | Intrinsic event (see event handlers) |
| onmousedown | Intrinsic event (see event handlers) |
| onmouseup | Intrinsic event (see event handlers) |
| onmouseover | Intrinsic event (see event handlers) |
| onmousemove | Intrinsic event (see event handlers) |
| onmouseout | Intrinsic event (see event handlers) |
| onkeypress | Intrinsic event (see event handlers) |
| onkeydown | Intrinsic event (see event handlers) |
| onkeyup | Intrinsic event (see event handlers) |
|
Also see the HTML 5 version of HTML tags
Enjoy this page?
-
- Link to this page (copy/paste into your own website or blog):
- Link to Quackit using one of these banner ads.
Thanks for supporting Quackit!