The reason being that a CSS class name may only begin with an underscore (_), a dash (-), or a letter(a–z).
These may be followed by any number of dashes, underscores, letters, or numbers.
Please also note that the following is not valid mark-up and won’t work in older browsers, such as IE7 or IE8:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>This will work in modern browsers, but isn't valid markup</title>
<style>p2 {color:#cd0000; font-size: 15px;font-weight:bold;} </style>
</head>
<body>
<p2>C5D: (Certificates in 5 Days)</p2>
</body>
</html>
you wont be able to apply “failclass” to an element as the parser considers it an element ( albeit undefined, and I’ll touch on that in a minute), but “realcass” will apply to any element that has that string n the class attribute <div class=" hey realclass">…</div>.
H1 -H6, of course are Headings… not classes. but P1, p2,etc do not actually exist in HTML. UAs go ahead an create the tags anyway and some even allow the tags to be styled via CSS. This doesnt mean that it is valid markup!!! So no creating tags willy-nilly.
Takeaway:
In a stylesheet:
begins IDs, eg.: #myId, #branding
. begins classes , eg.: .myClass, .clear, .story
not having either will make the parser assume you are targeting a tag, eg.: h1,h2,p,div
you CANNOT start classes, IDs or tag names with numbers !!
[font=verdana]Some browsers would still work if you used numbers, although it’s against the spec.
If I knew what UAs were, that bit might help me more
UA = user-agent. That’s just another way of saying “browser or equivalent”, which also encompasses robots (like Googlebot) and accessibility technology.[/font]
body {background: #708090; font color: black; font-weight: bold; font-style: italic; font-size: 15px; font-family: New Century Schoolbook", Times, serif;}
To this:
body {background: #708090; color: black; font-weight: bold; font-style: italic; font-size: 15px; font-family: "New Century Schoolbook", Times, serif;}
p.two is CSS not html and would look for a class on a p element. It is not valid to have class=“p.two” as already mentioned by the others as certain characters are not allowed.
there are no mark up errors
My browsers tells me there are 36 errors
As an aside try not to use breaks to space things out and avoid deprecated presentational tags and attributes (eg. <center>). Us paragraphs for text content and where extra space is needed use margins or padding and not another break.
That’s it ! the solution. You have put it so simply and straightforwardly. It is now working,
Thanks very much.
With regards to this
<As an aside try not to use breaks to space things out and avoid deprecated presentational tags and attributes (eg. <center>). Us paragraphs for text content and where extra space is needed use margins or padding and not another break. >
it’s what I am trying to do. The site was originally still in frames !
This has the added bonus that you don’t have to touch this again. PHP will always add the current year for you.
Does that help?
P.S. In future, when you post code examples, could you wrap them in code tags, please? You can do this by clicking “Go Advanced” and selecting the appropriate language from the “syntax” drop down.
The class belongs to the anchor so it would be a.four and not p.four (although you don’t really need the “a” as .four will do just fine).
.four,.four:visited {color:#000}
p.four would assume that the class was on a p element and then to target a nested anchor you would need to say p.four a{styles etc…}
Rather than use vague classnames like .two or .three you should try and create classnames that give some meanng to the css. If you look in a stylesheet and all you see is .four,.five,.six then you won;t hgave a clue to what they refer to.
You should use classes that have some meaning for the context they are being used.
e.g.
.warning{color:red}
.highlight{color:yellow}
.maintitle{color:blue}
.subtitle{color:green}
Don’t be tempted to use things like .red(color:red} becaues if you decide to change the colour at a later date you will have to change the html as well which could be in hundreds of pages.