How to insert a button in HTML

The <button> tag in HTML defines a clickable button.

Syntax

The general syntax is:

<button>Button Name</button>
svg viewer

Inside a <button> element you can put the following content:

Adding Text

You can add text to the HTML Button.

For example, to create a submit button you can write:

<button type="button">Submit</button>

Adding Image

You can put an image in HTML Button.

For example, to create a image button write:

<button><img src="image url"></button>

HTML Attributes

HTML button have various attributes.

Syntax

The general syntax for adding attributes to the html button is:


<button type="button" attribute-name>Button Name</button>

Disabled

The disabled attribute makes the button unusable and unclickable.

Autofocus

The autofocus attribute specifies that the button should automatically get focus when the page loads.

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved