HTML CSS Bootstrap Javascript Icons Python
HTML References
HTML - Tag Reference HTML - Tag by Category HTML - Attributes HTML - Global Attributes HTML - Events HTML - Language Codes HTML - Country Codes HTML - URL Encoding HTTP Methods HTTP Status Codes <input> types
All HTML Tags
<!-- --> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <data> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <h1> - <h6> <head> <header> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <main> <map> <mark> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <picture> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <svg> <table> <tbody> <td> <template> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>

HTML type Attribute

The type attribute specifies the type of element.

When used with <button> elements, the type attribute specifies the type of button.

When used with <input> elements, the type attribute specifies the type of input element to display.

When used with <ol> elements, the type attribute specifies the kind of numbering type to use in the list.

When used with <embed>, <link>, <object>, <script>, <source>, and <style> elements, the type attribute specifies the media type (MIME type).

Applies to

The type attribute can be used on the following elements:

Element Attribute
<button> type
<embed> type
<input> type
<link> type
<menu> type
<object> type
<ol> type
<script> type
<source> type
<style> type

Syntax:

<element type="value">
Run code

Browser compatibility

The type attribute has the following browser support for each element:

Element
<button> yes yes yes yes yes
<embed> yes yes yes yes yes
<input> yes yes yes yes yes
<link> yes yes yes yes yes
<menu> yes yes yes yes yes
<object> yes yes yes yes yes
<ol> yes yes yes yes yes
<script> yes yes yes yes yes
<source> 4 3.5 10.5 4 9
<style> yes yes yes yes yes

Attribute Values

The following table describes the values of type attribute:

Value Description Allowed in these elements
list Specifies a list menu. A list of commands, that the user can activate <menu>
context Specifies a context menu. The menu must be activated before the user can interact with the commands <menu>
toolbar Specifies a toolbar menu. Active commands, allows the user to interact with the commands immediately <menu>
button Defines a clickable button <button>, <input>
checkbox Defines a checkbox <input>
color Defines a color picker <input>
date Defines a date control (year, month, day (no time)) <input>
datetime-local Defines a date and time control (year, month, day, time (no timezone) <input>
email Defines a field for an e-mail address <input>
file Defines a file-select field and a "Browse" button (for file uploads) <input>
hidden Defines a hidden input field <input>
image Defines an image as the submit button <input>
month Defines a month and year control (no timezone) <input>
number Defines a field for entering a number <input>
password Defines a password field <input>
radio Defines a radio button <input>
range Defines a range control (like a slider control) <input>
reset Defines a reset button (resets the form-data to its initial values) <button>, <input>
search Defines a text field for entering a search string <input>
submit Defines a submit button (submits form-data) <button>, <input>
tel Defines a field for entering a telephone number <input>
text Default. Defines a single-line text field <input>
time Defines a control for entering a time (no timezone) <input>
url Defines a field for entering a URL <input>
week Defines a week and year control (no timezone) <input>
a
A
i
I
1
Specifies the kind of marker to use in the list

  • 'a' indicates lowercase letters,
  • 'A' indicates uppercase letters,
  • 'i' indicates lowercase Roman numerals,
  • 'I' indicates uppercase Roman numerals,
  • '1' indicates numbers (default).
<ol>
MIME-type
Specifies the media type of the file

For more info see IANA Media Types

<embed>, <link>, <object>, <script>, <source>, <style>

More Examples

The following example specifies an embed element with type attribute:

Run code

The following example specifies an object element with type attribute:

Run code

The following example specifies 2 source elements with type attribute:

Run code

This example specifies different kind of numbering type to use in the list:

Run code