style type attribute
The type attribute on the style element:
- allows you to specify the media (MIME) type of the internal style sheet; information useful for user agents
- type is a specific attribute → can be applied ONLY on the next html elements: a, area, button, embed, input, link, menu, menuitem, object, ol, script, source, style
- if the type attribute is missing, the default MIME types for the internal style sheet is:
- text⁄css (for .css file format: style.css)
Examples
<style | attribute | = | "value(s)" | > | ... | <⁄style> | example |
---|---|---|---|---|---|---|---|
2. | type | = | MIME type | <type="text/css"> CSS rules <⁄ > |
Video demonstration style type attribute
HTML5 style type attribute Tutorial
min | video details |
---|---|
00:08 | video tutorial style element, type attribute objective: adding the corresponding MIME type to the internal style sheet |
00:15 | - the type attribute is optional - if missing, like in our case, the default media type is text⁄css |
00:22 | - the rules inside the style element belong to CSS - the corresponding MIME type for CSS is: text⁄css → the value of the type attribute will be: text⁄css |
00:29 | as we said, adding the type attribute is optional, more, is the type attribute is missing, the default value is text⁄css, BUT for example purpose we will add the type attribute to the style element with the value text⁄css |
00:37 | adding the type attribute to the style element represents useful information for user agents |
00:37 | note: this kind of information does not display in browser |