<style>: The HTML Style Element
I. Description
The
HTML
<style>
element is used to hold
CSS
styling
instructions which the web browser may use to alter the appearance of the web page.
The
<style>
element must be a child of the
<head>
element.
Generally speaking it is better to put
CSS
styling instructions in a separate file and
use the link element to bring the
CSS
styling instructions into your web page, rather than
embed them directly into the webpage with the
<style>
element.
II. Examples
<!DOCTYPE html>
<html>
<head>
<title>CSS Styling Example</title>
<style>
h1 {
font-weight: bold;
color: red;
}
p {
background-color: blue;
color: red;
}
</style>
</head>
<body>
<h1>CSS Styling example</h1>
<p>The appearance of this web page will be controlled via CSS.</p>
</body>
</html>
This document was last updated: