f



Correct XHTML: <FONT class=aaa> .... without "FONT" ???

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.
So how do I specify otherwise new font attributes to only a few words?

<class=aaa>...</class> does not work.

Matt

0
MattCAdams
1/4/2004 1:32:53 PM
comp.authoring.stylesheets 8158 articles. 0 followers. mdmoura (161) is leader. Post Follow

7 Replies
573 Views

Similar Articles

[PageSpeed] 42

On Sun, 4 Jan 2004 14:32:53 +0100, Matt Adams wrote:

> However when I let this html source validate the FONT tag is
> marked as not compatible with XHTML. So how do I specify
> otherwise new font attributes to only a few words?

<p>Now is the <span class="foo">winter</span> of our discontent.</p>

or

<p>Now is the <span style="font-weight: bold;">winter</span> of our
discontent.</p>

More info: <http://www.w3schools.com/html/html_fonts.asp>

Ian
-- 
http://www.aspipes.org/
http://www.bookstacks.org/
http://www.learnsomethingnew.us/
0
Ian
1/4/2004 1:56:43 PM
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

0
Jim
1/4/2004 1:57:50 PM
Matt Adams wrote:

> I want define for a couple of words inside a longer text with different
> font specifications. I declared it like:

> <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. So how do I specify otherwise new font attributes
> to only a few words?

Pick the most appropriate element, and that depends on what meaning you wish
to convey. <em> might be suitable.

-- 
David Dorward                                      <http://dorward.me.uk/>
0
David
1/4/2004 2:29:56 PM
On Sun, 04 Jan 2004 14:32:53 +0100, Matt Adams wrote:

> <class=aaa>...</class> does not work.

<span class="aaa">...</span>

-- 

..

0
Vigil
1/4/2004 2:44:52 PM
Please consider configuring your newsreader software to wrap lines at
65 or so characters.

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.

It sounds like you should consider a primer on (x)html if you're still
thinking in terms of <font>.

> So how do I specify otherwise new font attributes to only a few
> words

Use an inline element that is appropriate.

http://www.w3.org/TR/html401/struct/text.html#h-9.2

Here are a few examples:

<P>Unix is a flexible <abbr title="operating system">os</abbr>. And it
is not as difficult as some people think. Getting a list of files in a
directory is really quite easy. Type <kbd>ls</kbd> at the prompt to
get a directory listing. Typing <kbd>dir</kbd> will <em>not</em> work;
that is a <abbr title="disk operating system">DOS</abbr> command! And
let's face it: <abbr title="disk operating system">DOS</abbr> is a
<strong>terrible</strong> <abbr title="operating system">os</abbr>.
</P>

If none of the elements listed at the uri above is appropriate, then
use <span>, which is generic (i.e., it has no semantic meaning).
Whatever element you choose, use css to alter its presentation to suit
your needs.

> <class=aaa>...</class> does not work.

Class is not an element in any dtd that I know of.  It is an
attribute.  It may be useful to you to divide elements into
categories, especially useful if you use the generic span frequently.

<P>Unix is a flexible <abbr title="operating system">os</abbr>. And it
is not as difficult as some people think. Heck, it is as easy as
<span class="cliche">falling off a horse</span>....
</P>

In your css,

span.cliche { font-family: serif; }

-- 
Brian
follow the directions in my address to email me

0
Brian
1/4/2004 2:48:14 PM
In article <bt94m4$u6a$07$1@news.t-online.com> in 
comp.infosystems.www.authoring.html, 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.
>So how do I specify otherwise new font attributes to only a few words?
>
><class=aaa>...</class> does not work.

Where do you define this class aaa? If you've got it as CSS style 
sheet, then it's simple:

<span class="aaa"> these text should get other attributes </span>

Note the quote marks around the class name: presently optional (but 
a good idea), we already know they will be required in future 
versions of HTML.

If you don't know what CSS is or how to link to it, start with these 
references:
	http://www.htmlhelp.com/reference/css/quick-tutorial.html
	http://brainjar.com/css/using/

-- 
Stan Brown, Oak Road Systems, Cortland County, New York, USA
                                  http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator:      http://validator.w3.org/
CSS 2 spec:     http://www.w3.org/TR/REC-CSS2/
   2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator:      http://jigsaw.w3.org/css-validator/
0
Stan
1/4/2004 3:47:31 PM
"Matt Adams" <MattCAdams@email.com> wrote in message
news:bt94m4$u6a$07$1@news.t-online.com...
....
> ...text before....
> <FONT class=aaa> these text should get other attributes </FONT>
> text after

try..
....text before....
<span class='aaa'>these text should get other attributes</span>
text after

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site


0
Andrew
1/4/2004 8:30:47 PM
Reply: