<button>: The HTML Button Element

1 Description

The HTML <button> element is used to create a clickable button. <button> elements are typically used to submit data entered into <form> elements, or (to put it another way) to allow users to send information from the web browser back to the web server.

<button> elements typically contain a single word which will be displayed on the button, something that informs the user what the button does.

2 Examples

<!DOCTYPE html>
<html>
    <head>
        <title>Example Page</title>
    </head>
    <body>
        <h1>Login Page</h1>
        <form action="/api/account/login" method="POST">
            <label for="username">Username</label>
            <input id="username" type="text" placeholder="Username">
            <label for="password">Password</label>
            <input id="password" type="password" placeholder="Password">
            <button type="submit">Login</button>
        </form>
    </body>
</html>

This document was last updated: