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?
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.)
Internal style sheets.
<p class="StyleRed">First item</p>
<p id="StyleBlue">Second item</p>
Explicit use of styles.
<p style="color: #00FF00;">Last item</p>
font-family: Script, "Comic Sans MS";
A style tag can be in the body. (HTML 5 only
supports style tags with the scoped attribute in the body.)