English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Der HTML <style>-Tag wird verwendet, um CSS in das HTML-Dokument einzubinden. Er kann in den <body>-Tag oder den <head>-Tag eingefügt werden. Standardmäßig ist die Stylinformation des <style>-Tags normalerweise im Format von CSS. Dieser Tag wird auch oft als <style>-Element bezeichnet.
Verwenden Sie das <style>-Element im HTML-Dokument:
!doctype html> <html> <head> <meta charset="UTF-8"> <title>HTML style-Tag-Benutzung (Grundtutorials-Netz oldtoolbag.com)</title> </head> <style> h1 { color: blue; } .p-style{color:red;font-weight:bold;} </style> </head> <body> <h1>HTML5 Example</h1> <p class="p-style">Dies ist ein Absatz mit einem style-Stil</p> </body </html>Testen Sie es heraus ‹/›
IEFirefoxOperaChromeSafari
Alle gängigen Browser unterstützen den <style>-Tag.
Der <style>-Tag definiert die Stylinformationen eines HTML-Dokuments.
Im <style>-Element können Sie bestimmen, wie ein HTML-Dokument im Browser dargestellt wird.
Jeder HTML-Dokument kann mehrere <style>-Tags enthalten.
Hinweis:Verwenden Sie <link> Tag.
Hinweis:Um mehr über die Kenntnisse von Stylesheets zu lernen, lesen Sie bitte unsere CSS Tutorial.
Note:If the "scoped" attribute is not used, each <style> tag must be located in the head area.
"scoped" attribute is HTML 5 New attribute in, it allows us to define styles for specific parts of the document rather than the entire document.
If the "scoped" attribute is used, the specified style can only be applied to the parent element and its child elements of the style element.
New: HTML5 New attribute in.
Attribute | Value | Description |
---|---|---|
media | media_query | Specify different media types for the style sheet. |
scopedHTML5 | scoped | If this attribute is used, the style is applied only to the parent element of the style element and its child elements. |
type | text/css | Specify the MIME type of the style sheet. |
Support for <style> Tag Global Attributes of HTML.
Support for <style> Tag HTML Event Attributes.
HTML Tutorial:HTML CSS
HTML DOM Reference Manual:Style Object