Skip to content
Related Articles

Related Articles

HTML | type Attribute

View Discussion
Improve Article
Save Article
  • Difficulty Level : Hard
  • Last Updated : 06 Jun, 2022
View Discussion
Improve Article
Save Article

The HTML type Attribute is used to specify the type of button for <button> elements. It is also used in the <input> element to specify the type of input to display. For embed elements like link, object, script, source, and style used to specify the Internet Media Type. 

Syntax: 

<element type="value"> 

Note: This attribute has been DEPRECATED and is no longer recommended.

Supported Tags: 

  • <a>
  • <area>
  • <embed>
  • <input>
  • <link>
  • <menu>
  • <object>
  • <script>
  • <source>
  • <style>

The below example illustrates the use of type attribute in HTML:

Example: 

html




<!DOCTYPE html>
<html>
    <head>
        <title>
            HTML type Attribute
        </title>
    </head>
     
    <body>
        <h1>GeeksforGeeks</h1>
         
        <h3>HTML type Attribute</h3>
         
        <form action="#" method="get">
            Username: <input type="text" name="uname">
             
            <br><br>
             
            Password: <input type="password" name="pwd">
             
            <br><br>
             
            <button type="submit" value="submit">
                Submit
            </button>
             
            <button type="reset" value="reset">
                Reset
            </button>
        </form>
    </body>
</html>                   

Output: 
 

Supported Browsers: The browser supported by HTML type attributes are listed below: 

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

 


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!