473,543 Members | 2,001 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Different background colors for inidividual words ?

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
3 6574
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
Bob - Andover, MA <ts****@yahoo.c om> 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****@stanford alumni.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
In article <a8************ **************@ posting.google. com>,
ts****@yahoo.co m 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="backgrou nd-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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
8670
by: Scott | last post by:
There is a setting in IE for "Print background colors and images." I've noticed that without checking this option, a web page will print CSS lines between table rows, but a background color of say the header won't. The below style will display the borders in print preview, but won't display the background color. Does anyone know if it's...
1
3188
by: Spike | last post by:
Hello! Im going to make a javascript for changing alot of images. But im not sure how to do it., where to start.. Ok, first.. this is the isue. I have 3 images(I call them 1a-3a). when u click on image 1a u change" image x" to image 1a when u click on image 2a u change" image x" to image 2a when u click on image 3a u change" image x" to...
6
5220
by: Louise | last post by:
Hi I have written an HTML pages which does not have any colour specifying tags as far I know. When I view this in an Microsoft internet explorer browser it appears with a white background and black text but when I change Windows start menu->settings->control panel ->display -> appearance and change scheme to 'High Contrast Black' the...
3
3035
by: Bob - Andover, MA | last post by:
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...
25
12903
by: Neal | last post by:
According to the CSS lint at http://htmlhelp.org/tools/csscheck/, "The shorthand background property is more widely supported than background-color." Can anyone point me to, or provide, information on what browsers have difficulty with the non-shortcut methods of setting background properties?
6
7046
by: Pasi Kovanen | last post by:
How do I define for example link inside H1 style to be of different color than other links in the same page: <a href="blah">this is some color</a> <h1><a href="blahblah">this is different color</a></h1> I remember seeing suitable code for this a couple of years ago but wasn't able to google my way to it.
16
3924
by: J. B. Moreno | last post by:
I read the faq, and it mentions that IE 4 on windows requires setting a printing option to allow background colors to be printed. Things change, life goes on, other browsers come into existence.... So, is there a way in CSS to say "Yeah, print these background colors", without the user having to turn on an option that will then apply to...
4
4078
by: Franklin | last post by:
WITHOUT KNOWING ANYTHING ABOUT THE CURRENT COLORS, I want to swap the foreground/background colors of a link when someone hovers over it. Is this possible with HTML, CSS, DOM, & JavaScript? If so, how? See my HTML below (or go to my test page at http://fmbbowen.com:39353/misc/Misc.html). I also tried treating ..color as a number and...
2
11107
by: gnosys | last post by:
In ASP.Net 1.1 using C#, I'm trying to dynamically change the background colors of certain listbox items based on some criteria. For example:
0
7412
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7355
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7356
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7697
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5892
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5285
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3395
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3395
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
648
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.