Advertisement
Home Open Editor ❯

HTML type Attribute

Example

<a href="https://www.google.com" type="text/html">google</a>

Try this code ❯

Meaning

The type attribute specifies the media type in the form of a MIME type.


Standard Syntax

<element type="mediaType">


Applies to:

The type attribute can be used on the following element:


Advertisement

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>

Try this code ❯


<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>

Try this code ❯


<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">

Try this code ❯


<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>

Try this code ❯


<link> Tag Example

<head>
  <link rel="stylesheet" type="text/css" href="demo/demo.css">
</head>

Try this code ❯


<object> Tag Example

<object data="demo/image.jpg" type="image/jpg" width="300" height="150"></object>

Try this code ❯


<ol> Tag Example

<ol type="i">
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
</ol>

Try this code ❯


<script> Tag Example

<script type="application/javascript">
  document.write("Hello World!");
</script>

Try this code ❯


<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>

Try this code ❯


<style> Tag Example

<style type="text/css">
body {background: tomato;}
h1 {color: white;}
p {font-family: monospace;}
</style>

Try this code ❯

Home Open Editor ❯
Advertisement