The type attribute defines the kind of element behavior or resource. Its allowed values depend on the element: most often <input> (form widgets) and <button> (submit / reset / button), also <script>, <link>, <ol>, and a few others.
On <input>, omitting type (or using an unknown value) falls back to text. Related form attributes: name, value, and required.
Baseline · Widely available.
Not deprecated. Core HTML. Individual input types vary slightly by browser, but common types (text, password, email, checkbox, radio, submit, …) are widely supported.
Not one meaning for every tag.
type on input is not the same as type on script or ol. Always read the values for the element you are using. Do not confuse with the separate legacy typemustmatch attribute.
Syntax
HTML Syntax
syntax.html
<element type="value">
Common shapes: <input type="email">, <button type="submit">, <script type="module">, <ol type="A">.
Open the browser console in Try It Yourself to see classic vs module scripts.
How It Works
Omit type on classic scripts — HTML assumes JavaScript.
type="module" — load as an ES module (deferred, strict, import/export).
ol type — chooses marker style (1, a, A, i, I).
Prefer CSS list-style-type for presentational lists when you can — type on ol is still valid HTML.
Edge Cases & Pitfalls
Most bugs come from assuming one type vocabulary for every element, or forgetting button defaults.
fallback
Unknown input type → text
An invalid value still looks like text. The content attribute may keep your string; the IDL type reports "text".
button
Bare <button> submits
Inside a form, default is submit. Use type="button" for clicks that must not send the form.
security
Types are not server validation
type="email" helps UX. Attackers can still POST anything — validate on the server.
script
Skip obsolete script MIME types
You do not need type="text/javascript" for classic scripts. Use type="module" only for modules.
legacy
typemustmatch is different
typemustmatch was an <object> legacy attribute. Do not mix it up with everyday type.
Compatibility
Browser Support
type is a core HTML attribute whose meaning depends on the element. Common input and button types are Baseline widely available.
✓ Baseline · Widely available
type
Supported everywhere modern browsers render HTML. Some newer input types (date, color, …) have historically uneven UI, but remain usable with graceful fallbacks.
98%Global support (approx.)
Google Chrome1+
Full support
Mozilla Firefox1+
Full support
Apple Safari1+
Full support
Microsoft Edge12+
Full support
Opera4+
Full support
Samsung InternetModern · Full
Full support
Internet Explorer2+ (basic)
Supported
typeWidely supported
Bottom line: Safe to rely on for forms and buttons. Check MDN for niche input types if you need pixel-perfect picker UI on every browser.
Remember
Key Takeaways
Role: declare what kind of control or resource the element is.
Input: defaults to text; pick email, password, checkbox, and so on for better UX.
Button: use type="button" when you must not submit the form.
Context: same name, different vocabularies per element.
One line:type tells the browser which kind of input, button, script, or list you want — always match the value to the element.
Frequently Asked Questions
It defines the kind of control or resource for the element that owns it. Meaning depends on the element: on input it picks the widget (text, email, checkbox…); on button it sets submit/reset/button; on script or link it is often a MIME type; on ol it sets the list marker style.
If you omit type, or use an unknown value, the input behaves as type="text". The content attribute may still show your invalid string, but the IDL type property returns "text".
Inside a form, a <button> defaults to type="submit". Use type="button" for non-submit actions so clicking does not send the form.
No. type is not one global attribute with one meaning. Always check which element you are on — input, button, script, link, ol, and others each define their own allowed values.
Modern HTML treats classic scripts as JavaScript by default. Prefer omitting type, or use type="module" for ES modules. An obsolete language-style MIME is unnecessary for normal scripts.
No. type itself is standard and widely supported. Some old uses (for example certain presentational values) are obsolete, and typemustmatch on object is a separate legacy attribute — not the same as type.