1. Technology

The BUTTON Tag

By

HTML Button Tag

< Previous | HTML 4.01 Tags | XHTML 1.0 Elements | Next >

Free HTML Class | HTML Validators

BUTTON Description:

The BUTTON tag defines a versatile button element for HTML forms.

BUTTON Web Browser Support:

HTML Versions

BUTTON Attributes:

Global attributes, event attributes and:

BUTTON End Tag:

</button> REQUIRED

BUTTON Contents:

CDATA. Encloses HTML tags that make up the input button, usually an image. The following tags are valid within the BUTTON tag:
a, abbr, acronym, address, applet, b, bdo, big, blockquote, center, cite, code, dfn, dir, div, dl, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, i, iframe, img, input, isindex, kbd, label, mao, menu, noframes, noscript, object, ol, p, pre, q, s, samp, script, select, small, span, strike, strong, sub, sup, table, textarea, tt, u, ul, var

BUTTON Valid Context:

The BUTTON tag is valid within the following tags:
a, abbr, acronym, address, applet, b, bdo, big, blockquote, body, caption, center, cite, code, del, dd, dfn, div, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, i, iframe, ins, kbd, label, legend, li, noframes, noscript, object, p, pre, q, s, samp, small, span, strike, strong, sub, sup, td, th, tt, u, var

BUTTON Examples:

button with text

<form action="#">
<button type="submit" name="button1" value="clicked">
Submit
</button>

</form>

See the button with text on a web page.

button with an image

<form action="#">
<button type="submit" name="button1" value="clicked">
<img src="cecb2.gif" width="32" height="32" alt="submit" border="0" />
</button>

</form>

See the button with an image on a web page.

button with both text and an image

<form action="#">
<button type="submit" name="button1" value="clicked">
<p>
Submit Now<br/>
<img src="http://webdesign.about.com/library/graphics/cecb2.gif" width="32" height="32" alt="submit" border="0" />
</p>
</button>

</form>

See the button with both image and text on a web page.

Notes About the BUTTON Tag:

  • Watch the whitespace in this element. Some browsers include it in the button while others don't. So you might end up with designs that don't look as you expect.

More BUTTON Information:

< Previous | HTML 4.01 Tags | XHTML 1.0 Elements | Next >

Free HTML Class | HTML Validators

©2014 About.com. All rights reserved.