The HTML <style>
element contains style information for a document, or part of a document. By default, the style instructions written inside that element are expected to be CSS.
Content categories |
Metadata content, and if the scoped attribute is present: flow content. |
---|---|
Permitted content | Text content matching the type attribute, that is text/css . |
Tag omission | Neither tag is omissible. |
Permitted parents | Any element that accepts metadata content. |
Permitted ARIA roles | None |
DOM interface | HTMLStyleElement |
This element includes the global attributes.
type
text/css
if it's missing.media
all
if the attribute is missing.title
<style type="text/css"> body { color:red; } </style>
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of 'style' in that specification. | Living Standard | |
HTML5 The definition of 'style' in that specification. | Recommendation | No change from HTML 4.01 Specification. |
HTML 4.01 Specification The definition of 'style' in that specification. | Recommendation |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | 1.0 | (Yes) | 1.0 (1.7 or earlier) | 3.0 | 3.5 | 1.0 |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 1.0 | (Yes) | 1.0 (1.0) | 9.0[1] | 6.0 | 1.0 |
[1] Mobile Internet Explorer (the previous branding of IE Phone - versions lower than 8) also has support.
<link>
element allowing to use external style sheets.
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style