HTML Button Tag: What are the Uses of Button In HTML Form

  • Post category:HTML
  • Post author:
  • Post last modified:June 11, 2022
  • Reading time:4 mins read
You are currently viewing HTML Button Tag: What are the Uses of Button In HTML Form

The button element in HTML Forms specifies a button. The button element can contain text, images and tags( <i>, <strong>, <b>) and input element type attribute value button does not contain any text or tags.And this is the main difference between the two buttons.

The button element is mainly used to submit or reset form data and call the JavaScript function

Button tag – Syntax

The button element start with the <button> tag and closed with the </button> tag.

<form action="action_page">
<input type="text" name="user_name">
<button type="submit">Submit>/button>
</form>

Example of HTML Button

Button Tag Attributes

  • type – the type attribute for the button element tells the browsers what type it is.
  • name – the name attribute defines the name of the button.
  • value – the value attribute defines the initial value of the button element.

Button Tag type attribute

the type attribute of the button element tells the browser what type of button.

<button type="button">Click Me</button>
<button type="submit">Click Me</button>
<button type="reset">Click Me</button>

The name attribute

The name attribute defines the name of the button element.

<button type="button" name="click_me">Click Me</button>

The value attribute

The value attribute defines the initial value of the button element.

<button type="button" name="click_me" value="submit">Click Me</button>

HTML Button With CSS

Use HTML Button As link

Chapter Summary

  • HTML Button tag specifies a clickable button on an HTML document, which is used as an ordinary button or submits, clears an HTML form.
  • The Button tag in HTML comes with opening and closing tag pairs. The button tag starts with the opening <button> tag and closed with the closing </button tag.
  • With CSS you can transform a normal HTML button into a beautiful HTML button.

Ashim Khatua

Professionally Web Developer since 2015, And also a Blogger. I am the founder of SiteCodings.com. I love to share my knowledge, which I earned the past few years. I want to share my knowledge with you through my Blog. Keep Reading.

Leave a Reply