HTML | button Tag

The <button> tag in HTML is used to define the clickable button. <button> tag is used to submit the content. The images and text content can use inside <button> tag.

Syntax:

<button type = "button">

Example:



filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>button tag</title>
    </head>
      
    <body>
        <p>button tag</p>
          
        <!-- button tag starts from here -->
        <button type = "button" onclick
            "alert('Welcome to GeeksforGeeks')">
            Click Here
        </button>
        <!-- button tag ends here -->
          
    </body>
</html>                    

chevron_right


Output:

Note:

  • Different browsers use different default types for <button>.
  • Buttons can be styled using CSS.
  • HTML5 added some new attributes.
    • autofocus
    • form
    • formaction
    • formnovalidate
    • formenctype
    • formmethod
    • formtarget

Supported Browsers: The browser supported by <button> tag are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.