The <button>
tag in HTML defines a clickable button.
The general syntax is:
<button>Button Name</button>
Inside a <button>
element you can put the following content:
You can add text to the HTML Button.
For example, to create a submit button you can write:
<button type="button">Submit</button>
You can put an image in HTML Button.
For example, to create a image button write:
<button><img src="image url"></button>
HTML button have various attributes.
The general syntax for adding attributes to the html button is:
<button type="button" attribute-name>Button Name</button>
The disabled
attribute makes the button unusable and unclickable.
The autofocus
attribute specifies that the button should automatically get focus when the page loads.