button tag in html code example
Example 1: how to add buttons in html
<button type="button" onclick="alert('You pressed the button!')">Click me!</button>
Example 2: html button
<html>
<head>
<style>
.button {
background-color: <background color>;
border: none;
color: <text color>;
padding: 10px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 4px;
cursor: pointer;
border-radius: 8px;
}
</style>
</head>
<body>
<a href="<url>" class="button">ButtonText</a>
</body>
</html>
Example 3: how to make a button in html
<button>I'm a button</button>
Example 4: input button html
The <input type="button"> defines a clickable button (mostly used with a JavaScript to activate a script).
Syntax
<input type="button">
A push button that activates a JavaScript when it is clicked:
<input type="button" value="Click me" onclick="msg()">
And there is also different kind of buttons are there
<input type="submit">
<input type="reset">
These buttons are mostly used in form processing concept.
where submit button is use to submit the form data and reset button is for to blank out the form fields.
Example 5: button in html
<button></button>