Where CSS Exists


Click here to change the theme.

I am learning CSS. I am having difficulty understanding it conceptually. All the books and articles I have found describe CSS in a detailed manner. This page is a question. Hopefully I can convert this into an answer.

The following is a sample HTML page with explanations of the CSS in it. My question is, is this a complete identification of everywhere CSS could exist in a HTML file? I think this at least shows all the common uses (at least) of CSS in terms of where it can be used. Is it?

<!DOCTYPE html>
<html>
<head>
No CSS here.
<link href="../style.css" rel="stylesheet" type="text/css"/>
<style src="style.css" type="text/css"/>
External style sheets. (The style tag with src attribute is not supported by HTML 5.)
<style type="text/css">
.auto-style1 {
text-align: center;
}
.StyleRed {
color: #FF0000;
}
#StyleBlue {
color: #0000FF;
}
</style>
Internal style sheets.
</head>
<body>
No CSS here.
<p class="StyleRed">First item</p>
<p id="StyleBlue">Second item</p>
Explicit use of styles.
<p style="color: #00FF00;">Last item</p>
Inline style.
<style type="text/css">
p {
font-family: Script, "Comic Sans MS";
}
</style>
A style tag can be in the body. (HTML 5 only supports style tags with the scoped attribute in the body.)
</body>
</html>
No CSS here.