The type attribute in HTML specifies the type of content associated with an element, such as the button type, the media type of a source in an audio or video tag, or the type of input in a form element.
Syntax:
<element type="value">
Note: This attribute has been DEPRECATED and is no longer recommended.
Supported Tags:
Tag name | Description |
---|---|
Is used to create a hyperlink on the webpage. | |
Is used to defines an area inside an image map. | |
Is used embeds external content like images, audio, or video. | |
Is used to defines an input field that allows users to enter data. | |
Is used to define a link between a document and an external resource. | |
Is used to defines an Unordered List of items. | |
Is used to display multimedia like audio, videos, images, PDFs, and Flash on web pages. | |
The HTML <script> tag is used to embed or reference JavaScript code. | |
Is used to specifies multiple media resources for <picture>, <audio>, or <video> elements. | |
<style> | Is used to defines internal CSS styles for a document. |
HTML type Attribute Examples
Example 1: In this example we created a form with input fields for username and password, utilizing the type attribute to specify input types. It includes buttons for submission and reset functionalities.
<!DOCTYPE html>
<html>
<head>
<title>HTML type Attribute</title>
</head>
<body>
<h3>HTML type Attribute</h3>
<form action="#" method="get">
Username:
<input type="text" name="uname" />
<br /><br />
Password:
<input type="password" name="pwd" />
<br /><br />
<button type="submit" value="submit">
Submit
</button>
<button type="reset" value="reset">
Reset
</button>
</form>
</body>
</html>