Stylesheets
UTF-8
Your external stylesheet does not have an html head or foot, so your first line must be:
@charset "utf-8";
which tells the user's server that your encoding is in the character set called "utf-8".
When you copy and paste from a MSWord document into your Notepad, you carry across curved quotes, hyphens, question marks, and other punctuation not members of utf-8, so these must be replaced (using Menu >> Edit >> Replace with ...).
Failing to do this, will cause the W#C validator to give an error like this :
Sorry ! I cannot validate this.
Reading further down the page will give you:
Sorry, I am unable to validate this document because on line 179 it contained one or more bytes that I cannot interpret as utf-8...
or similar. You will then ask: where is line xxx ? (I was told line 179 when there was only 140 lines in the file.)
When you see this vague message, guess the cause and seek those peculiar punctuation marks. For each punctuation, cut and paste into the upper textfield of the Edit-Replace dialogue box, add your Notepad version to replace it, and click [Replace all].
Save, and Revalidate to see if you have solved the problem.
Style versus class
Like you, xhtml has both style and class:
- style="": style is defined by the XHTML code, but you can refine it.
- class="": class is defined by you.
Do not confuse the two.
Now comes the confusing bit – a stylesheet is where you refine xhtml styles, and define your classes.
You immediately recognize a stylesheet by its extension, ".css".
In this css file, there is no header like you must have in .htm files. so you begin refining and defining immediately.
Here we go:
Open Notepad, name it 11_content.css and save into your folder www. It pays to begin numbering at 11 not 1, because Windows Explorer puts anything begiining with 1, together, so that 10_me.htm is immediately after 1_me.htm and before 2_me.htm.
cut and paste these lines into your 11_content.css.
body {
background-color:#ccffff;color:#0000ff;
font-family: Times;font-size: 12pt;width:620px;
margin:0.5em;padding:0.5em; /* pixels, px, varies with user's monitor setting; em = width of the letter "M" and so relates to the font-family and font-size set by the programmer or user. */
scrollbar-face-color:#0000ff;
}
table{border: 0px none; rules: none; background-color: transparent; font: normal 12pt/14pt "Times New Roman"; align= "center";}
.b3{border:3px double #8b0000; rules:1px; background-color:#ffe4b5;} /* padding gives the gap inside the border while margin gives the gap outside the border. */
a:link{color:#0000ff};a:active{color:#ff00ff};a:visited{color:#660066};
a:link, a:active, a:visited {text-decoration:none} /* "decoration:none" removes the default underlining. Dont forget the commas separating these attributes. */
.n{font-style:normal;}
.i{font-style:italic;}
.b{font-weight:bold;}
.c{text-align:center;}
.r{text-align:right;}
.l{text-align:left;}
.f24{font-size:24pt;}
.f18{font-size:18pt;}
.f14{font-size:14pt;}
.f12{font-size:12pt;}
.f10{font-size:10pt;}
.f9{font-size:9pt;}
Note that attributes are separated from each other by semicolons, and each attribute is separated from its value by a colon.
Continuing, this stylesheet is then linked into each file with the line:
<link rel="stylesheet" href="11_content.css" type="text/css" />
This is inserted into the large gap between the head tags:
<head><title>...</title></head>
<div class="b3 b f24">Class</div> will give you script 24pts big, in bold, surrounded by a double-border in #8b0000 color, and background-color = #ffe4b5.
Class
The 3 browsers, IE, Firefox and Opera, recognize the demand for bold script and the characteristics of the box but only IE recognizes the demand for 24pt script; Firefox and Opera do not.
For all 3 to recognize the font-size you have to script using styles, like:
<div style="font-size:24pt/36pt" class="b3 b">Class</div> using style as in style="font-size: 24pt/36pt;". The 24pt is the font-size and the 36pt is the line-height.
Class
Class
My computer's OS does not offer line-height of 36pt, and this prevents it offering 24pt font-size as well.
I have defined the class b3 as:
b3 = {border: 3px double #8b0000;background-color: #ffe4b5;}
but xhtml has defined style="fontsize: ... ;" and all I can do is refine it by putting in a value for font-size.
Body{...} and table{...} are refinements, and so come under styles. Every file which is linked to this css file, will have a body and table conforming to these refinements.
When you use the body tag <body> the body of the document automatically conforms to your refinements expressed in your css stylesheet:
body {
background-color: #ccffff; color: #0000ff;
font-family: "Times New Roman"; font-size: 12pt;
width: 620px; margin: 5px; padding: 5px;
scrollbar-face-color: #0000ff;
}
To change this body use a style or class within the body tag, as in:
<body style="font-size: 24pt; color: green; background-color: red">.
Adding it into this tag will over-ride the css stylesheet.
Similarly, whenever you use the table tag, <table>, your table will conform to your refinement in your css stylesheet:
table{border: 0px none; rules: none; background-color: transparent; font: normal 12pt/14pt "Times New Roman"; align= "center";}
To change this table use your class b3 as in <table class="b3">.
Adding it into this tag will over-ride the css stylesheet.
There is much much more, but this will be enough for beginning your website. Later you can visit http://www.w3.org
Oops ! I forgot. If you wish to include in your website a link to another website, use your usual link like this:
<a href="http://www.w3.org">http://www.w3.org</a>
to give: http://www.w3.org
and always test it.
Scrollbar color
Margins, scrollbar-face-color is not a known CSS property name – DONT USE IT.
scrollbar-face-color is an Internet Explorer/Opera Only property and is not supported by firefox. Therfore you are getting the validation error because it's not standard CSS.
Firefox is not compatible with custom scrollbar colors. No matter how a webpage is designed w.r.t the scrollbar and whatever its HTML code, Firefox doesn't allow changes to the color of its scrollbar. However, IE and Opera are among the browsers which will support custom scrollbar colors.
Few threads exist in the dynamic drive forums regarding this. For more information check it out: http://www.dynamicdrive.com/forums/archive/index.php/t-5005.html and http://www.dynamicdrive.com/forums/archive/index.php/t-7502.html
Here's an example of the scrollbar CSS properties code in a webpage:
{
scrollbar-face-color: #FF00FF;
scrollbar-shadow-color: #0AB0FF;
scrollbar-highlight-color: #00FF00;
scrollbar-3dlight-color: #FF00FF;
scrollbar-darkshadow-color: #00FFFF;
scrollbar-track-color: #FFCC00;
scrollbar-arrow-color: #000000;
}
However, Firefox doesn't support the scrollbar CSS properties, so this coding shouldn't work on the Firefox browser.
Attributes
Remembering which attributes go where is difficult.
The validator does not allow <body> to take the attribute "width=620px", but width can be determined for a frame by the frameset (see the chapter Newbie) or, within the body, by blockquote, div and table.
If you cannot afford a manual for XHTML, then try using the attribute. If it fails in your browser or W3C validator, then go to the Internet reference.
Begin the reference from the official XHTML Reference must-know-list: http://xhtml.com/en/xhtml/reference/#reference-must-know-list