asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Language References > HTML Elements > INPUT type=button Element

<input type=button> Element


Creates a button control.HTML 2, 3.2, 4, 4.01, 5

HTML Syntax

NOTE: Only the <input> start tag must be present. The element has no end tag.

Remarks

The <input type=button> element renders a push button on an HTML form.

The text to be displayed in the button is specified thru its value attribute.

<input type="button" value="Click me">

Push buttons have no default behavior. In most cases, a client-side script is associated with any of the element’s event attributes, to make the button perform an action when an event occurs, such as when a user clicks the button.

Browsers normally render the <input type=button> as a basic button with a simple default appearance. Authors may use CSS to vary its appearance though.

Note that authors can create push buttons with the newer <button> element as well, that offers richer rendering capabilities than the this element.

Attributes

The <input_button> element supports the following attributes, in addition to global attributes common to all HTML elements.

AttributeValueDescription
popovertargetelement_idSpecifies which popover element to invoke
popovertargetactionhide, show, toggleSpecifies what happens to the popover element when you click the button

Example

The following shows how the <input type=button> element may be used.

This is done by specifying any ECMAScript-compliant statement or function call as the value of the button’s onclick event attribute. When the event occurs, the associated script is triggered.

<form>
   <input type="button" value="Say Hello"
      onclick="alert ( 'Hello' )">
</form>

The following shows how the appearance and behavior of the button may be altered using CSS.

<input type="button" 
   class="button" value="Say Hello"
   onclick="alert ( 'Hello' )">
.button { 
   font-weight: 600; padding: 5 20;
   color: white; text-shadow: 2px 2px 2px #000;
   background: linear-gradient(steelblue,green);
   box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.6);
   border-radius: 12px;
}
.button:hover {
   cursor: pointer; scale: 1.1;
   background: linear-gradient(red,orange);
   box-shadow: -3px 3px 3px rgba(0, 0, 0, 0.6);
}

External References

See Also

BUTTON   INPUT   INPUT type=reset   INPUT type=submit


Need a break ?
Suggested Reading

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph.

If you have any question, comment or suggestion,
please send us a note