473,396 Members | 2,033 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,396 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 13064
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.