HTML type Attribute
Example
<a href="https://www.google.com" type="text/html">google</a>
Meaning
The type attribute specifies the media type in the form of a MIME type.
Standard Syntax
<element type="mediaType">
Browser Support
Status
Applies to:
The type attribute can be used on the following element:
Element | Attribute |
---|---|
<a> | type |
<area> | type |
<button> | type |
<embed> | type |
<input> | type |
<link> | type |
<object> | type |
<ol> | type |
<script> | type |
<source> | type |
<style> | type |
Attribute Values
Value | Description |
---|---|
mediaType | Specifies the Internet media type of the embedded content. IANA Media Types |
More Examples
<area> Tag Example
<img src="img/desk.jpg" usemap="#image-map">
<map name="image-map">
<area type="image/png" target="_blank" alt="Computer" title="Computer" href="img/computer.png" coords="365,99,905,783" shape="rect">
<area type="image/png" target="_blank" alt="Cup" title="Cup" href="img/cup.png" coords="1047,672,97" shape="circle">
<area type="image/png" target="_blank" alt="Mobile" title="Mobile" href="img/mobile.png" coords="960,385,1040,541" shape="rect">
<area type="image/png" target="_blank" alt="Book" title="Book" href="img/book.png" coords="175,426,96,527,20,664,232,755,298,628,364,505" shape="poly">
</map>
<button> Tag Example
<form action="action.html" method="get">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<button type="submit">Submit</button>
<button type="reset">Submit to another link</button>
</form>
<embed> Tag Example
<h1>embed video</h1>
<embed type="video/webm" src="demo/video.mp4" width="300" height="150"><br><br>
<h1>embed image</h1>
<embed type="image/jpeg" src="demo/image.jpg" width="300" height="150">
<input> Tag Example
<form action="action.php">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br>
<input type="submit" value="Submit">
</form>
<link> Tag Example
<head>
<link rel="stylesheet" type="text/css" href="demo/demo.css">
</head>
<object> Tag Example
<object data="demo/image.jpg" type="image/jpg" width="300" height="150"></object>
<ol> Tag Example
<ol type="i">
<li>One</li>
<li>Two</li>
<li>Three</li>
</ol>
<script> Tag Example
<script type="application/javascript">
document.write("Hello World!");
</script>
<source> Tag Example
<audio controls>
<source src="demo/demo.mp3" type="audio/mpeg">
<source src="demo/demo.ogg" type="audio/ogg">
Your browser does not support the audio tag.
</audio>
<style> Tag Example
<style type="text/css">
body {background: tomato;}
h1 {color: white;}
p {font-family: monospace;}
</style>