By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,396 Members | 1,869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,396 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Jul 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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

Jul 20 '05 #2

P: n/a
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/
Jul 20 '05 #3

P: n/a
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/>
Jul 20 '05 #4

P: n/a
On Sun, 04 Jan 2004 14:32:53 +0100, Matt Adams wrote:
<class=aaa>...</class> does not work.


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

--

..

Jul 20 '05 #5

P: n/a
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

Jul 20 '05 #6

P: n/a
"Matt Adams" <Ma********@email.com> wrote in message
news:bt*************@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
Jul 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.