Embedded Style Sheets

A style sheet can be embedded at the top of an HTML or XHTML document using the style element, which must appear within the head element:

<html><head><title>Stylin'!</title>
<style type="text/css">
h1 {color: purple;}
p {font-size: smaller; color: gray;}
</style>
</head>
   ...
</html>

XML languages may or may not provide an equivalent capability; always check the language DTD to be certain.

Get CSS Pocket Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.