Different background colors for inidividual words ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob - Andover, MA

    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
  • Jim Dabell

    #2
    Re: Different background colors for inidividual words ?

    Bob - Andover, MA wrote:
    [snip][color=blue]
    > However, I'd like to be able to change background colors on a
    > word-by-word basis, or at least sentence-by-sentence basis.[/color]
    [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

    Comment

    • Darin McGrew

      #3
      Re: Different background colors for inidividual words ?

      Bob - Andover, MA <tsreyb@yahoo.c om> wrote:[color=blue]
      > 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?[/color]

      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, mcgrew@stanford alumni.org, http://www.rahul.net/mcgrew/
      Web Design Group, darin@htmlhelp. com, http://www.HTMLHelp.com/

      "There is no right way to do the wrong thing."

      Comment

      • kaeli

        #4
        Re: Different background colors for inidividual words ?

        In article <a8cd904e.04010 81306.43e2dac6@ posting.google. com>,
        tsreyb@yahoo.co m enlightened us with...[color=blue]
        >
        > Is there a way to change a word's background color and not have that
        > word get seperated from the preceeding and following words?
        >[/color]

        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?



        Comment

        Working...