Skip to main content
D
HTML
HTML Buttons

HTML Buttons

HTML buttons trigger actions when clicked.

Read Time
5 min read
Difficulty
Beginner
Last Updated
Jun 15, 2026
Version
v1.0.0

Introduction

HTML provides the `

Syntax

Syntax
1<!-- button syntax -->
2<button type="button">Click Me</button>

Example

Example
1<!-- this creates a button -->
2<!DOCTYPE html>
3<html lang="en">
4  <head>
5    <meta charset="UTF-8">
6    <meta name="viewport" content="width=device-width, initial-scale=1.0">
7    <title>Buttons</title>
8  </head>
9  <body>
10    <button type="submit">Send Message</button>
11  </body>
12</html>

Try it Yourself

Hands-on Practice
Modify the code below to see how it affects the output. This is the best way to learn!
Interactive Editor
1234567891011121314151617181920
Live Preview

Key Points

  • The `
  • Buttons accept child elements like images.
  • The `type` attribute defines the button behavior.
  • JavaScript attaches click events to buttons.

Up Next

Continue your journey with the next topic.

Go to HTML Iframes