473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

Jul 20 '05 #1
6 13063
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
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
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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matt Adams | last post by:
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.