The STYLE element defines a style in a document.
This element is placed inside the HEAD element.
<style type="text/css">
CSS Codes
</style>
| Attribute | Value | Explanation |
|---|---|---|
| type=" " | text/css | content type |
| media=" " | media type names | specifies the medium |
About the media attribute
The media attribute specifies the medium to which the style sheet should be applied.
The value is a single or comma-separated list.
<style type="text/css" media="screen"> - </style>
<style type="text/css" media="screen, print"> - </style>
| screen | for computer screens |
| tty | for fixed-pitch character grid displays |
| tv | for television-type devices |
| projection | for projectors |
| handheld | for handheld devices |
| for printers | |
| braille | for braille tactile feedback devices |
| aural | for speech synthesizers |
| all | for all devices |
<html>
<head>
<title>TAG index</title>
<style type="text/css">
body {
text-align: center;
}
h1 {
color: #ff0000;
}
</style>
</head>
<body>
<h1>Example page</h1>
</body>
</html>
<html> <head> <title>TAG index</title> <style type="text/css" media="screen"> body { text-align: center; } h1 { color: #ff0000; } </style> <style type="text/css" media="print"> h1 { text-decoration: underline; } ul { display: none; } </style> </head> <body> <h1>Example page</h1> <ul> <li><a href="../../index.html">Home</a></li> <li><a href="../index.html">HTML Tags</a></li> <li><a href="index.html">Page Tags</a></li> </ul> <p>The difference of the style can be confirmed by the browser's print preview.</p> </body> </html>