|
Posted by Jukka K. Korpela on 03/16/07 10:42
Scripsit Reiner Wagner:
> I like to use a tag <red> like the tag <b>, that means I like to use
> the following:
>
> <p>This is a <red>test</red></p>
>
> and the word "test" got the color red.
You've got several answers, some of them partially correct. You cannot get a
completely correct answer without giving more information. Why would you
make the word red, and in what context?
In HTML as such, you cannot just add tags. In XML containing XHTML tags,
which might be seen as "extended XHTML", you can, but whether browsers get
it right is a different issue.
In practice, if you want the word to appear in red, without disclosing any
information of _why_ it is red, the best approach is
<p>This is a <font color="red">test</font></p>
There's nothing more structural in using <span>; it just makes some people
think that they are separating content from presentation when they aren't.
Then you might consider even dropping the attribut color="red" and using CSS
code like
font { color: red }
but that would be somewhat unnatural and risky, since someone might later
add <font size="2"> just to reduce font size without realizing what will
happen.
If you really _mean_ to _emphasize_ a word and to suggest that the emphasis
be rendered by the use of red color only, then the best bet is
<p>This is a <strong>test</strong></p>
together with
strong { color: red;
background: white;
font-weight: normal; }
in CSS. (<strong> appears in bold by default on most browsers, and
font-weight: normal turns that off.)
(Why <strong>? Because if you want to use red, then you probably want strong
emphasis, rather than the one conveyed by <em>.)
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
Navigation:
[Reply to this message]
|