To create a button in HTML, you can use the <button> element. Here’s a simple example:
< !DOCTYPE html > <html lang=”en”> <head> <meta charset=”UTF-8″> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <title>HTML Button Example</title> </head> <body> <!– This is a button with the label “Click me!” –> <button>Click me!</button> </body> </html>
In this example, the <button> element is used to create a button with the label “Click me!”. When you open this HTML file in a web browser, you’ll see a button that users can click.
You can also add various attributes to the <button> element to customize its appearance or behavior. For example, you can use the type attribute to specify the type of the button (e.g., “button,” “submit,” or “reset”), and you can use the onclick attribute to define a JavaScript function that will be executed when the button is clicked.
Comments