link type attribute
The type attribute on the link element:
- allows you to specify the media (MIME) type of the linked resource; information useful for user agents
- type is a specific attribute → can be applied ONLY on the next HTML5 elements: a, area, button, embed, input, link, menu, menuitem, object, ol, script, source, style
MIME types Examples for different resources:
- - image⁄png (for .png image format: image.png)
- image⁄gif (for .gif image format: image.gif)
- image⁄jpeg (for .jpeg image format: image.jpeg)
- image⁄pjpeg (for .jpeg image format in IE: image.jpeg)
- image⁄vnd.microsoft.icon (for .ico image format: favicon.ico)
- text⁄css (for .css file format: style.css)
- text⁄html (for .php file format: index.php)
- text⁄javascript (for .js file format: script.js)
- audio⁄ogg (for .ogg audio file format: sound.ogg)
- audio⁄mp4 (for .mp4 audio file format: sound.mp4)
- video⁄ogg (for .ogg video file format: video.ogg)
- application⁄zip (for .zip file format: file.zip)
Examples
<link | attribute | = | "value(s)" | > | Examples | ||
---|---|---|---|---|---|---|---|
5. | type | = | MIME type | <type="text⁄css" rel="stylesheet" href="URL"> |
Video demonstration link type attribute
HTML5 link type attribute Tutorial
min | video details |
---|---|
00:07 | this video tutorial presents the type attribute on a link element |
00:17 | there are 3 link elements on page |
00:21 | adding the type attribute to each link element |
00:34 | type attribute allows us to add the corresponding MUME type of the linked resource; this information is useful for user agents |
00:42 | the corresponding media type for an image .png format is: image⁄png |
00:47 | the corresponding media type for an cascading style sheet .css format is: text⁄css |
00:52 | the corresponding media type for an html file .php format is: text⁄html |