Matt Adams wrote:
I want define for a couple of words inside a longer text with different
font specifications. I declared it like:
...text before....
<FONT class=aaa> these text should get other attributes </FONT>
text after
However when I let this html source validate the FONT tag is marked as not
compatible with XHTML.
The <font> element type is not part of XHTML 1.0 Strict. If you really need
it, then use XHTML 1.0 Transitional. It's almost certain you don't need to
use it though - presentation is a stylesheet's job.
So how do I specify otherwise new font attributes
to only a few words?
<class=aaa>...</class> does not work.
Why would it? You can't just go around making up syntax and expect it to
work.
How you go about doing this depends on why you want to do it. Are you
changing the style of these few words because it's a heading? Use one of
the heading elements (<h1> to <h6>) and style them using a simple selector:
<h1>...</h1>
h1 {
font-size: 150%;
font-weight: bold;
border: thin solid blue;
}
Are you changing the style of these few words because it's an error message
or other warning? Use strong emphasis:
<strong>...</strong>
strong {
font-weight: bold;
font-size: 110%;
}
If it's a special type of emphasis, use a class:
<strong class="error">...</strong>
strong.error {
font-weight: bold;
color: red;
background: white;
text-decoration: blink;
}
If it's something else, consult an HTML tutorial or the specification to see
what other element types are available to you:
<URL:http://www.w3.org/TR/html401/index/elements.html>
If you can't find an appropriate element type, use a <span> element with an
appropriate class:
<span class="company-name">...</span>
span.company-name {
font-weight: bold;
color: blue;
background: white;
}
--
Jim Dabell