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

Different background colors for inidividual words ?

P: n/a
I know how to define a background color for the entire page, and for a
table, and even using style sheets and 'P CLASS=...' for changing
paragraph background colors.

However, I'd like to be able to change background colors on a
word-by-word basis, or at least sentence-by-sentence basis. Using a
paragraph divider splits up the words or sentences, which is not
desired. I want the word to still appear inline with its neighboring
words.

Is there a way to change a word's background color and not have that
word get seperated from the preceeding and following words?

thanks,
-Bob
Andover, MA
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Bob - Andover, MA wrote:
[snip]
However, I'd like to be able to change background colors on a
word-by-word basis, or at least sentence-by-sentence basis.

[snip]

From <URL:http://www.google.com/groups?selm=m_...N6Lth2WiRVn-jg
40giganews.com>:

How you go about doing this depends on why you want to do it.
[snip]
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;
}

(Presentation is a stylesheet's concern; followup set to ciwas.)

--
Jim Dabell

Jul 20 '05 #2

P: n/a
Bob - Andover, MA <ts****@yahoo.com> wrote:
However, I'd like to be able to change background colors on a
word-by-word basis, or at least sentence-by-sentence basis. Using a
paragraph divider splits up the words or sentences, which is not
desired. I want the word to still appear inline with its neighboring
words.

Is there a way to change a word's background color and not have that
word get seperated from the preceeding and following words?


See the answer to the Frequently Asked Question, "How do I change the color
of some text?" http://www.htmlhelp.com/faq/html/des...color-sometext
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"There is no right way to do the wrong thing."
Jul 20 '05 #3

P: n/a
In article <a8**************************@posting.google.com >,
ts****@yahoo.com enlightened us with...

Is there a way to change a word's background color and not have that
word get seperated from the preceeding and following words?


span

<p>
Hi! <span style="background-color:#ababab">How </span> are you?</p>
<span class="whatever"...
<span id="whatever" ...

--
--
~kaeli~
Why did kamikaze pilots wear helmets?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.