one simple question

L

Leo Baumann

hello,

how can i change the color of one word in a standart html-text ?

thanks ...

mfg Leo
 
B

Barbara de Zoete

Please state a subject in the subject field of your post. 'one simple
question' is not the subject. It is 'changing color of one word'

how can i change the color of one word in a standart html-text ?

What is a standard html-text? HTML is Hyper Text Markup Language. One
marks up content with semantic tags, elements. I recon you mean text in a
paragraph, but then my glass ball might be a bit damp.

What is the reason you want one word to change color? Isn't it confusing
if that one word that jumps out doesn't do anything, like being a link or
having a specific title? If it is just a dfferent color it might confuse
your visitor.

Having said all that, here is a way to do what you want:

Firstly, think of the reason you want a word to stand out in your text,
for example because it is jargon and you want to assist visitors in
understanding it. From the reason think of a proper name for a class,
because that is what you will be using. For jargon, .jargon might be a
useful class name. Then make the class and define the styles you want it
to have and make sure they are different from the styles applied to your
hyperlinks.

html in the body of your page:
<p>If one is about to use <abbr class="jargon" title="Hyper Text Markup
Language">HTML</abbr> and style it too, one could go to <a
href="http://www.w3schools.org/html/default.asp">W3C's html course</a> to
learn proper markup and to <a
href="http://www.w3schools.org/css/default.asp">W3C's CSS course</a> to
learn about styling.</p>

css in the head of your page:
<style type="text/css">

..jargon {
color:teal;
border-bottom:1px dotted teal;
cursor:help; }

</style>

Hope this helps.
 
L

Liz

In message <opsihlunqkx5vgts@zoete_b>
Firstly, think of the reason you want a word to stand out in your text,
for example because it is jargon and you want to assist visitors in
understanding it. From the reason think of a proper name for a class,
because that is what you will be using. For jargon, .jargon might be a
useful class name. Then make the class and define the styles you want it
to have and make sure they are different from the styles applied to your
hyperlinks.

html in the body of your page:
<p>If one is about to use <abbr class="jargon" title="Hyper Text Markup
Language">HTML</abbr> and style it too, one could go to <a
href="http://www.w3schools.org/html/default.asp">W3C's html course</a> to
learn proper markup and to <a
href="http://www.w3schools.org/css/default.asp">W3C's CSS course</a> to
learn about styling.</p>

css in the head of your page:
<style type="text/css">

.jargon {
color:teal;
border-bottom:1px dotted teal;
cursor:help; }

</style>

Hope this helps.
<heresy>
If you think that's using a sledgehammer to crack a nut, and you don't
mind about being deprecated (have to validate transitional), you can just
use <font color:#ffcc33>word</font>.
</heresy>
:)

Slainte

Liz
 
B

Barbara de Zoete

In message <opsihlunqkx5vgts@zoete_b>

<heresy>
If you think that's using a sledgehammer to crack a nut, and you don't
mind about being deprecated (have to validate transitional), you can just
use <font color:#ffcc33>word</font>.
</heresy>
:)

Yes. As I stated I gave *a* way to do it. Judging from his question (how
to change color of a word) the OP is not really very competent with html
or css yet. I based my response on that judgement (for all I know, I might
be completely wrong), and tried not only to solve a simple 'problem' but
give a learning opportunity as well. With that I take no shortcuts. Learn
the proper way, learn the cheats later when you know what you are doing
wrong on purpose, why you are doing things wrong on purpose and what the
effect might be for doing it wrong on purpose.
 
H

Hywel Jenkins

invalid@v- said:
In message <opsihlunqkx5vgts@zoete_b>

<heresy>
If you think that's using a sledgehammer to crack a nut, and you don't
mind about being deprecated (have to validate transitional), you can just
use <font color:#ffcc33>word</font>.
</heresy>
:)

No you can't.
 
D

Dylan Parry

Barbara said:
Dylan, see what you did? You spoiled him out of his chance to learn
something. :-(

Not so. He learned how to change the color of words using HTML/CSS. He
asked a direct question, so I gave a direct answer.

It really gets on my whick when people insist on answering something
with "blah blah Google blah blah" or with the most vague of answers that
still require the OP to go off and spend hours reading up on something.
In your case it was the suggestion of a sledgehammer when the OP
requested a toffee hammer :)

You also gave him a misleading answer as yours was specific to the case
of changing the color of an abbreviation, whereas the OP asked about the
generic situation of change "a word" as in *any* word.
 
B

Barbara de Zoete

Not so. He learned how to change the color of words using HTML/CSS. He
asked a direct question, so I gave a direct answer.

It really gets on my whick when people insist on answering something
with "blah blah Google blah blah" or with the most vague of answers that
still require the OP to go off and spend hours reading up on something.
In your case it was the suggestion of a sledgehammer when the OP
requested a toffee hammer :)

You also gave him a misleading answer as yours was specific to the case
of changing the color of an abbreviation, whereas the OP asked about the
generic situation of change "a word" as in *any* word.

Well, we just disagree. I wonder what OP's next question is. 'How do I
remove the line under a link?'
 
D

Dylan Parry

Barbara said:
Well, we just disagree.

That's okay. Can you imagine how awful the world would be if everyone
agreed with each other and we all got along? :D
I wonder what OP's next question is. 'How do I
remove the line under a link?'

Heh :) Depends on how much of a newbie he really is... that is a bit
advanced! I would expect a true newbie to say "I have a page with three
frames, and one has a table in it containing all my animated gifs. How
can I make the bottom frame refresh using just HTML? Also how can I make
it so that the visitors can't change the font size, cos when they do my
page looks ugly and the tables get broken?"
 
B

Barbara de Zoete

That's okay. Can you imagine how awful the world would be if everyone
agreed with each other and we all got along? :D

Well, I think one can disagree firmly but get along fine and that is the
way I prefer it to be.
Heh :) Depends on how much of a newbie he really is... that is a bit
advanced! I would expect a true newbie to say "I have a page with three
frames, and one has a table in it containing all my animated gifs. How
can I make the bottom frame refresh using just HTML? Also how can I make
it so that the visitors can't change the font size, cos when they do my
page looks ugly and the tables get broken?"

LOL
 
N

Neal

hello,

how can i change the color of one word in a standart html-text ?

Is it merely decorative? Use the span element as others have described.

Is it for emphasis, does it imply stress on the word? Use the em element.
Possible stylesheet:

em.foo {
color: #ff0000;
font-style: none;
}

<p>This word is <em class="foo">emphasized</em> with color. In a no-CSS
browser it will be done in some other way. Replace "foo" with whatever
makes more sence, considering the purpose of this coloring.</p>

(Note - the first declaration sets the color. The second undoes the
automatic italicization of the em element.)

If you do it with span, then no-CSS environments will do nothing. With the
em, it should do something, if not what you want. So in either case, do
not ask people to "look at the red word" because it might not be red for
them.
 
L

Leo Baumann

i remove the lines under links within explorers extras ... :),
i've seen it somewher ....

best regards Leo
 
N

Neal

Neal:
Leo Baumann:

BTW, not related to your color question:

<a name="#Rosh">

This is incorrect, the # should not be here. It should only be in your
href leading to here. Because of this, I didn't see that you were trying
to direct me to this section, because it failed in my browser (as it
should in a conforming browser).

BTW, 93 validator errors assuming a transitional doctype. Your HTML
generating software is rather poor, I'm afraid.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top