Horje
HTML type Attribute

Definition and Usage

For <button> elements, the type attribute specifies the type of button.

For <input> elements, the type attribute specifies the type of <input> element to display.

For <embed>, <link>, <object>, <script>, <source>, and <style> elements, the type attribute specifies the Internet media type (formerly known as MIME type).


Applies to

The type attribute can be used on the following elements:

Elements Attribute
<a> type
<button> type
<embed> type
<input> type
<link> type
<menu> type
<object> type
<script> type
<source> type
<style> type

Browser Support

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


How to add Two button elements that act as one submit button and one reset button (in a form) - HTML type Attribute

Button Example. The button type attribute.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The button type attribute</h1>

<form action="/action_page.php" 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" value="Submit">Submit</button>
  <button type="reset" value="Reset">Reset</button>
</form>

</body>
</html>

Output should be:

How to add Two button elements that act as one submit button and one reset button (in a form) - HTML type Attribute

How to add An embedded flash animation with a specified media type - HTML type Attribute

Embed Example.

index.html
Example: HTML
<embed type="image/jpg" src="https://horje.com/avatar.png">

Output should be:

How to add An embedded flash animation with a specified media type - HTML type Attribute

How to add An HTML form with two different input types; text and submit - HTML type Attribute

Input Example.

index.html
Example: HTML
<form action="/action_page.php">
  <label for="username">Username: </label>
  <input type="text" id="username" name="username"><br>
  <input type="submit" value="Submit">
</form>

Output should be:

How to add An HTML form with two different input types; text and submit - HTML type Attribute

How to add In the following example, the type attribute indicates that the linked document is an external style sheet -

Link Example.

index.html
Example: HTML
 <head>
<link rel="stylesheet" type="text/css" href="theme.css">
</head> 

Output should be:

How to add In the following example, the type attribute indicates that the linked document is an external style sheet -

How to add An <object> element with a specified media type - HTML type Attribute

The object type attribute.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The object type attribute</h1>

<object data="https://horje.com/avatar.png" type="image/jpg" width="500" height="300">
</object>
 
</body>
</html>

Output should be:

How to add An <object> element with a specified media type - HTML type Attribute

How to add A script with the type attribute specified - HTML type Attribute

The script type attribute.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The script type attribute</h1>

<p id="demo"></p>

<script type="text/javascript">
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>

</body>
</html>

Output should be:

How to add A script with the type attribute specified - HTML type Attribute

How to Use of the type attribute - HTML type Attribute

Source Example.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The source type attribute</h1>

<audio controls>
  <source src="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_5MG.mp3" type="audio/ogg">
  <source src="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_5MG.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>

</body>
</html>

Output should be:

How to Use of the type attribute - HTML type Attribute

How to Use the type attribute to specify the media type of the <style> tag - HTML type Attribute

Style of This is a heading  This is a paragraph.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<head>
<style>
h1 {color:red;}
p {color:blue;}
</style>
</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

Output should be:

How to Use the type attribute to specify the media type of the <style> tag - HTML type Attribute




html type attribute

Related Articles
HTML accept Attribute HTML Input HTML Attribute
HTML accept-charset Attribute HTML Attribute
HTML accesskey Attribute HTML Attribute
HTML action Attribute HTML Attribute
HTML alt Attribute HTML Attribute
HTML async Attribute HTML Attribute
HTML autocomplete Attribute in HTML HTML Attribute
HTML autofocus Attribute HTML Attribute
HTML autoplay Attribute HTML Attribute
HTML charset Attribute HTML Attribute
HTML checked Attribute HTML Attribute
HTML cite Attribute HTML Attribute
HTML class Attribute HTML Attribute
HTML cols Attribute HTML Attribute
HTML colspan Attribute HTML Attribute
HTML content Attribute HTML Attribute
HTML contenteditable Attribute HTML Attribute
HTML controls Attribute HTML Attribute
HTML coords Attribute HTML Attribute
HTML data Attribute HTML Attribute
HTML data-* Attribute HTML Attribute
HTML datetime Attribute HTML Attribute
HTML controls Attribute HTML Attribute
HTML default Attribute HTML Attribute
HTML defer Attribute HTML Attribute
HTML dir Attribute HTML Attribute
HTML dirname Attribute HTML Attribute
HTML disabled Attribute HTML Attribute
HTML download Attribute HTML Attribute
HTML draggable Attribute HTML Attribute
HTML enctype Attribute HTML Attribute
HTML enterkeyhint Attribute HTML Attribute
HTML for Attribute HTML Attribute
HTML form Attribute HTML Attribute
HTML formaction Attribute HTML Attribute
HTML headers Attribute HTML Attribute
HTML height Attribute HTML Attribute
HTML hidden Attribute HTML Attribute
HTML high Attribute HTML Attribute
HTML href Attribute HTML Attribute
HTML hreflang Attribute HTML Attribute
HTML http-equiv Attribute HTML Attribute
HTML id Attribute HTML Attribute
HTML inert Attribute HTML Attribute
HTML inputmode Attribute HTML Attribute
HTML ismap Attribute HTML Attribute
HTML kind Attribute HTML Attribute
HTML label Attribute HTML Attribute
HTML lang Attribute HTML Attribute
HTML list Attribute HTML Attribute
HTML loop Attribute HTML Attribute
HTML low Attribute HTML Attribute
HTML max Attribute HTML Attribute
HTML maxlength Attribute HTML Attribute
HTML media Attribute HTML Attribute
HTML method Attribute HTML Attribute
HTML min Attribute HTML Attribute
HTML multiple Attribute HTML Attribute
HTML muted Attribute HTML Attribute
HTML name Attribute HTML Attribute
HTML novalidate Attribute HTML Attribute
HTML onabort Attribute HTML Attribute
HTML onafterprint Attribute HTML Attribute
HTML onbeforeprint Attribute HTML Attribute
HTML onbeforeunload Attribute HTML Attribute
HTML onblur Attribute HTML Attribute
HTML oncanplay Attribute HTML Attribute
HTML oncanplaythrough Attribute HTML Attribute
HTML onchange Attribute HTML Attribute
HTML onclick Attribute HTML Attribute
HTML oncontextmenu Attribute HTML Attribute
HTML oncopy Attribute HTML Attribute
HTML oncuechange Attribute HTML Attribute
HTML oncut Attribute HTML Attribute
HTML ondblclick Attribute HTML Attribute
HTML ondrag Attribute HTML Attribute
HTML ondragend Attribute HTML Attribute
HTML ondragenter Attribute HTML Attribute
HTML ondragleave Attribute HTML Attribute
HTML ondragover Attribute HTML Attribute
How to add HTML ondragstart Attribute HTML Attribute
HTML ondrop Attribute HTML Attribute
HTML ondurationchange Attribute HTML Attribute
HTML onemptied Attribute HTML Attribute
HTML onended Attribute HTML Attribute
HTML onerror Attribute HTML Attribute
HTML onfocus Attribute HTML Attribute
HTML onhashchange Attribute HTML Attribute
HTML oninput Attribute HTML Attribute
HTML oninvalid Attribute HTML Attribute
HTML onkeydown Attribute HTML Attribute
HTML onkeypress Attribute HTML Attribute
HTML onkeyup Attribute HTML Attribute
HTML onload Attribute HTML Attribute
HTML onloadeddata Attribute HTML Attribute
HTML onloadedmetadata Attribute HTML Attribute
HTML onloadstart Attribute HTML Attribute
HTML onmousedown Attribute HTML Attribute
HTML onmousemove Attribute HTML Attribute
HTML onmouseout Attribute HTML Attribute
HTML onmouseover Attribute HTML Attribute
HTML onmouseup Attribute HTML Attribute
HTML onmousewheel Attribute HTML Attribute
HTML onoffline Attribute HTML Attribute
HTML ononline Attribute HTML Attribute
HTML onpageshow Attribute HTML Attribute
HTML onpaste Attribute HTML Attribute
HTML onpause Attribute HTML Attribute
HTML onplay Attribute HTML Attribute
HTML onplaying Attribute HTML Attribute
HTML onprogress Attribute HTML Attribute
HTML onratechange Attribute HTML Attribute
HTML onreset Attribute HTML Attribute
HTML onresize Attribute HTML Attribute
HTML onscroll Attribute HTML Attribute
HTML onsearch Attribute HTML Attribute
HTML onseeked Attribute HTML Attribute
HTML onseeking Attribute HTML Attribute
HTML onstalled Attribute HTML Attribute
HTML onsubmit Attribute HTML Attribute
HTML onsuspend Attribute HTML Attribute
HTML ontimeupdate Attribute HTML Attribute
HTML ontoggle Attribute HTML Attribute
HTML onunload Attribute HTML Attribute
HTML onvolumechange Attribute HTML Attribute
HTML onwaiting Attribute HTML Attribute
HTML onwheel Attribute HTML Attribute
HTML open Attribute HTML Attribute
HTML optimum Attribute HTML Attribute
HTML pattern Attribute HTML Attribute
HTML placeholder Attribute HTML Attribute
HTML popover Attribute HTML Attribute
HTML popovertarget Attribute HTML Attribute
HTML popovertargetaction Attribute HTML Attribute
HTML poster Attribute HTML Attribute
HTML preload Attribute HTML Attribute
HTML readonly Attribute HTML Attribute
HTML rel Attribute HTML Attribute
HTML required Attribute HTML Attribute
HTML reversed Attribute HTML Attribute
HTML rows Attribute HTML Attribute
HTML rowspan Attribute HTML Attribute
HTML sandbox Attribute HTML Attribute
HTML scope Attribute HTML Attribute
HTML selected Attribute HTML Attribute
HTML shape Attribute HTML Attribute
HTML size Attribute HTML Attribute
HTML sizes Attribute HTML Attribute
HTML span Attribute HTML Attribute
HTML spellcheck Attribute HTML Attribute
HTML src Attribute HTML Attribute
HTML srcdoc Attribute HTML Attribute
HTML srclang Attribute HTML Attribute
HTML <source> srcset Attribute HTML Attribute
HTML start Attribute HTML Attribute
HTML step Attribute HTML Attribute
HTML style Attribute HTML Attribute
HTML tabindex Attribute HTML Attribute
HTML target Attribute HTML Attribute
HTML title Attribute HTML Attribute
HTML translate Attribute HTML Attribute
HTML type Attribute HTML Attribute
HTML usemap Attribute HTML Attribute
HTML value Attribute HTML Attribute
HTML width Attribute HTML Attribute
HTML wrap Attribute HTML Attribute

Single Articles
How to add Two button elements that act as one submit button and one reset button (in a form) - HTML type AttributeHTML Attribute
How to add An embedded flash animation with a specified media type - HTML type AttributeHTML Attribute
How to add An HTML form with two different input types; text and submit - HTML type AttributeHTML Attribute
How to add In the following example, the type attribute indicates that the linked document is an external style sheet - HTML Attribute
How to add An <object> element with a specified media type - HTML type AttributeHTML Attribute
How to add A script with the type attribute specified - HTML type AttributeHTML Attribute
How to Use of the type attribute - HTML type AttributeHTML Attribute
How to Use the type attribute to specify the media type of the <style> tag - HTML type AttributeHTML Attribute

Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin


Reffered: https://www.w3schools.com/tags/att_type.asp