Producing web pages
* HTML CSS DHTML XHTML A to Z of tags        Accessibility          Design

<button>

<button
accesskey=key
disabled
class=type
dir=ltr|rtr
id=value
lang=language
name=name
style=style
tabindex=n
title=text
type=button|reset|submit
value=value
</button>

Defines a submit button, reset button, or push button. You can also use <input> to specify these buttons, but the <button> element allows richer labels, including pictures and emphasis.

The type attribute specifies the kind of button you want and takes the value submit (the default), reset, or button. The name and value attributes determine the name/value pair sent to the server when a users pushes the submit button. These attributes allow you to provide multiple submit buttons and have the program that handles the form take a different action depending on the submit button used.

Note: <button> is new in HTML 4.0 and most browsers do not yet support it.

Some examples:

<button name="submit" value="change">Change</button>
<button name="submit" value="continue">Continue</button>
<button>Submit <img src="checkmark.gif"></button>
<button type="reset">Reset <img src="x.gif"></button>
<button type="button" id="toggler" onclick="toggle()">
Hide text</button>The contents are rendered as a HTML button.

Attributes

accesskey=key

Specifies a shortcut key for the link. You activate the link by pressing Alt and the access key together; like standard menu shortcuts in Windows applications.

disabled

Used to disable an element.

class=type

Indicates the class to which the tag belongs. You can use the class attribute in a style sheet to create different styles that you want apply to a single HTML tag. For example, you might create three different styles for a heading <button> tag. See Using the class attribute as a selector for more details.

dir=ltr|rtr

Specifies the direction of text. This can be left-to-right (ltr) or right-to-left (rtl). For example, English characters are presented left-to-right, Hebrew characters are presented right-to-left.

id=value

Specifies a unique name for the tag. No two tags can have the same id on a single page. The value must begin with a letter followed by any alphanumeric character, a hyphen, an underscore, a colon or a full stop. You use it to reference a unique style for a tag or to manipulate the tag with a script.

lang=language

Specifies which language the <button> tag uses. You can enter any valid ISO standard language abbreviation, for example, “en” for English, “de” for German and so on. For example, <span lang="es">hola! como esta?</span>.

This attribute helps search engines understand different languages as different languages rather than just misspelled English. It may also help spelling and grammar checkers and allow speech synthesizers to use language-dependent pronunciation rules.

name=name

Specifies the name of the button.

style=style

Specifies style information. See Style sheets for more information.

tabindex=n

Specifies the position in the tabbing order.

title=text

For information only. Some browsers display the title when you move the mouse over the tag (like a tool tip).

type=button|reset|submit

The author can define a button that will have UI that indicates default for the Enter key (a dark border), and a button that will have default behaviour for the Esc key.

value=value

Specifies the value to be returned when the Boolean controls are turned on.