Stylesheets
Stylesheets
Books use the term "stylesheets" to include:
This muddling of terms I find confusing. It is natural to define them in this way:
Overwriting styles
External stylesheets are usually the most efficient way to write styles because the one css file can be linked into 6000 files.

Where the external stylesheet needs to be overwritten, then include styles within the head tags, as in:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>index</title>
<style type="text/css">
a:link, a:visited, a:active, a:focus {color:#ffaa33; text-decoration:none}
a:hover{color:#ffffaa; text-decoration:none}
body{
background-color:#8b0000;color:#ffaa33;
font: bold 12pt Arial;text-align:left;
padding-left: 5px;
}
hr{size:2px;color:#ffaa33;}
hr.40{width:40%;align:left}
.f18{font-size:18pt}
.g(color:green}
</style>
</head>

Where the style in the head needs to be overwritten, then insert the changed style into tags within the body, as in:
<div style="color:blue"> Hi ! My color is blue.</div>

If you have defined a style in an external stylesheet or in the head of the file, as in hr.40 or .f18 or .g above, then you can use classes as in:
<div class="f18 g"> My font is 18pt and green.</div>
Styles
Within a set of styles:
Notes on my styles
When learning scripting in HTML, my stylesheets grew and grew till several pages long. Now they have been reduced to a skeleton of 18 items. If any more styles are needed, they are scripted into the relevant tag on the spot or, if required frequently in the document then they go into the <head>.

After 4 years of scripting and re-scripting, designing and re-designing, with about 12 months or more wasted just re-doing in the hope of doing it better (more user-friendly, faster downloading), my guiding principle is a vehement KISS - keep it simple, stupid !
The simpler the better – the faster to download, the faster to write, check and maintain, the more user-friendly.

No pop-ups, no advertizing, no bells-n-whistles, just plain straight information.
No javascript, no applets, minimum styles, minimum frames, minimum formating, minimum indexing: Very user-friendly. KISS.

The symbols /* ... */ indicate comments made to help future webmasters, but, since they are ignored by the browser, these comments are not printed to the user's screen.

@charset "utf-8";
/* Placed on the first line of the css file and written within meta tags within head tags on all content files. Tells the browser that the script is in utf-8 coding, not ANSCII or some other. */

body {

/* margin = distance between outer element (frame) and this inner element (body).
padding = distance between this element and its content;
not inherited, being reset to zero; cannot be negative.
Frames have 5px margins, so body does not need margins. */

background-color:#fff8d6;color:#400000;
font-family: "Times New Roman";font-size: 12pt;

border: solid 2px #400000;padding:em;
/* Puts a border around the whole document, inside the frame's margin of 5px.
The padding of 1em is the width of the letter 'M' in the current font-size.
Subtract the size of the border to give the distance between the border and the text. */

scrollbar-face-color: #8b0000 <!-- not valid but IE recognizes it; Firefox does not. -->
} closing parenthesis for body{}.

table{border:0px none;background-color:transparent;font:normal 12pt/14pt "Times New Roman"}
th{background-color:} gives color to headings of table
td{padding:left:0.5em;padding:right:0.5em} ensures cell data looks neat.

.b3{border:3px double #8b0000;background-color:#ffe4b5}
ul{padding-let:0em} removes the indentation of text after the list and avoids the need to use <br />

.b2{border:solid 2px #400000;padding:1em} /* padding-left:1em is the distance from the border to the text;

margin-left is the distance from the edge of the body, to this border, that is, it moves the object (surrounded by this border) to the right. */

.b3{border:3px double #8b0000;background-color:#ffe4b5}
.b4{border:double 10px #400000;background-color:#ffe4b5;color:#400000;padding:2em}

Heading1Heading2
Heading1Heading2
Data11Data12
Data21Data22


Heading1Heading2
Data11Data12
Data21Data22


Heading1Heading2
Data11Data12
Data21Data22


Heading1Heading2
Data11Data12
Data21Data22
Heading1Heading2
Data11Data12
Data21Data22


Heading1Heading2
Data11Data12
Data21Data22


Heading1Heading2
Data11Data12
Data21Data22


Heading1Heading2
Data11Data12
Data21Data22

The scripting for the above tables is here:

Here is the table which encloses all the other tables.
It has a border and rules, which are internal borders. I called up the internal borders with border="3px". Later I use border="1px"/"2px"/"3px" but the width remains fixed at what seems to be 4px. Even the larger "10px" has no effect.
<table class="b3" border=".">
<thead><tr><th>Heading1</th><th>Heading2</th></tr></thead>
thead = "table head". tr = "table row". th = "table header".
<tbody> tbody = "table body".
<tr> tr = "table row".
<td> td = "table data".
Here is the first table in the left column.
It is borderless because in my stylesheet, K2.css, I defined it without borders.
<table>
<thead><tr><th>Heading1</th><th>Heading2</th></tr></thead>
<tbody>
<tr><td>Data11</th><td>Data12</th></tr>
<tr><td>Data21</th><td>Data22</td></tr>
</tbody>
</table>


Here is the 2nd table in the left column, with a solid brown border.

<table class="b2">
<thead><tr><th>Heading1</th><th>Heading2</th></tr></thead>
<tbody>
<tr>
<td>Data11</td><td>Data12</td>
</tr>
<tr>
<td>Data21</td><td>Data22</td>
</tr>
</tbody>
</table>


Here is the 3rd table in the left column, with a red double border.

<table class="b3">
<thead><tr><th>Heading1</th><th>Heading2</h></tr></thead>
<tbody>
<tr><td>Data11</td><td>Data12</td></tr>
<tr><td>Data21</td><td>Data22</td></tr>
</tbody>
</table>


Here is the 4th table in the left column, with a brown double border.

<table class="b4">
<thead><tr><th>Heading1</th><th>Heading2</th></tr></thead>
<tbody>
<tr><td>Data11</td><td>Data12</td></tr>
<tr><td>Data21</td><td>Data22</td></tr>
</tbody>
</table>


</td> This ends the first cell (left column) in the big table.
<td> This begins the next cell (right column) in the big table. The only difference is the addition of border="", inside the table tags of the 2nd, 3rd and 4th tables.

<table>
<thead><tr><th>Heading1</th><th>Heading2</th></tr></thead>
<tbody>
<tr><td>Data11</td><td>Data12</td></tr>
<tr><td>Data21</td><td>Data22</td></tr>
</tbody>
</table>

<table class="b2" border="1px">
<thead><tr><th>Heading1</th><th>Heading2</th></tr></thead>
<tbody><tr><td>Data11</td><td>Data12</td></tr>
<tr><td>Data21</td><td>Data22</td></tr>
</tbody>
</table>

<table class="b3" border="2px">
<thead><tr><th>Heading1</th><th>Heading2</th></tr></thead>
<tbody>
<tr><td>Data11</td><td>Data12</td></tr>
<tr><td>Data21</td><td>Data22</td></tr>
</tbody>
</table>

<table class="b4" border="3px">
<thead><tr><th>Heading1</th><th>Heading2</th></tr></thead>
<tbody><tr><td>Data11</td><td>Data12</td></tr>
<tr><td>Data21</td><td>Data22</td></tr>
</tbody>
</table>
</td> This ends the 2nd cell of data in the big table.
</tr> This ends the first (and only) row of the big table.
</tbody> This ends the table body.
</table> This ends the big table with its 2 columns.



.chemeq{font:normal 12pt/20pt Arial}
/* for tables containing chemistry equations. 12pt/20pt = font-size/line-height. This extra line-height is needed for the subscripts of chemical formulas.*/
.matheq{font:normal 12pt/40pt Arial}
/* for tables containing math equations. 12pt/20pt = font-size/line-height. This extra line-height is needed for the numerator/denominator of math equations. */

.u{text-decoration:underline}
/* class="b u" works only if b precedes u. */

h5{font:bold italic 12pt Arial;}
/* h tags are always bold in IE, but normal in Firefox unless font-weight:bold is inserted here. */

.p1{padding-left:1em}
/* In CSS, 1em = font-size.
class="p5" works with <div>, <ltd>, but not with <tr>, <tbody>, or <table>
Style="padding:0.5em" is valid.*/

.m1010{margin-left:10%;margin-right:10%;text-align:justify;font-style:italic;}
/* use div class="m1010", instead of blockquote. */

.m10{margin-left:10%;}
/* also works in tables with class="m10" */

ul{display:inline;list-style-type:square;list-style-position:outside;}
/* display:inline removes line break.
outside = hanging indent.
ul does not accept margin, padding. Use <li> to change distance from bullet to text. */

ol{display:inline;list-style-type:decimal;list-style-position:outside}
/* To begin at a specified number use <li value="5">, not <ol start="5"> which is deprecated. */

li{padding-left:0px;margin-left:5%}
/* This is essential. Margin indents bullets;
padding increases gap between bullet and text. */