HTML <style> Tag

<!DOCTYPE HTML>
<html>
<head>
<title>Quote of the Day</title>
<style>
body {font-family:sans-serif;}
blockquote { color:orange;font-family:serif;font-size:1.6em; }
cite {font-size:0.8em;}
</style>
</head>
<body>
<p>Quote of the day:</p>
<blockquote>From the errors of others, a wise man corrects his own.</blockquote>
<cite>Publilius Syrus</cite>
</body>
</html>

The above example demonstrates usage of the <style> element.

The <style> element is used for embedding styles into the HTML document.

The styles are inserted between the start and end tags. The type attribute can be used to specify the style sheet language. The default value is text/css, so if the type attribute is not provided, this used.

The media attribute can be used to specify the media that the styles belong to (eg, screen, print, etc). If this attribute is omitted, the value will be all, meaning that the styles will belong to all media.

Placement of the <style> Element

The <style> element must go into the document's <head> element. However, if the scoped attribute is used, it can go where flow content is expected (basically, anywhere within the body). If the scoped attribute is used, the styles are only applied to the parent subtree (elements that are a child of the <style> element's parent container).

Note that the scoped attribute is not supported in HTML5, however, it is supported in the WHATWG HTML Living Standard, and it is included in the W3C HTML 5.1 specification draft.