Changing colors

Discussion in 'HTML' started by Anders Christiansen, Mar 3, 2004.

  1. This is most likely dead simple.. i just can't get it to work.

    I want difrent color highlight on diffrent parts of my text. I want the
    color of the text to be the same..

    I hope someone can help me.

    Regards Anders Christiansen
     
    Anders Christiansen, Mar 3, 2004
    #1
    1. Advertising

  2. Anders Christiansen wrote:
    > This is most likely dead simple.. i just can't get it to work.
    >
    > I want difrent color highlight on diffrent parts of my text. I want
    > the color of the text to be the same..
    >
    > I hope someone can help me.
    >
    > Regards Anders Christiansen


    Markup:
    <p>This sentence <em>contains highlighted content</em> and makes sense
    semantically</p>

    CSS:
    body {
    color: #000000;
    background-color: #ffffff;
    }
    p em {
    color: #000000;
    background-color: #fbe54f;
    }
    --
    Andrew Urquhart
    Reply: www.andrewu.co.uk/about/contact/
     
    Andrew Urquhart, Mar 3, 2004
    #2
    1. Advertising

  3. Anders Christiansen

    Ryan Stewart Guest

    "Anders Christiansen" <> wrote in message
    news:c24ito$116q$...
    > This is most likely dead simple.. i just can't get it to work.
    >
    > I want difrent color highlight on diffrent parts of my text. I want the
    > color of the text to be the same..
    >
    > I hope someone can help me.
    >
    > Regards Anders Christiansen
    >

    <p style="color: red;">This is <span style="background-color: blue;">some
    blue stuff and this is</span> <span style="background-color: green;">some
    green stuff.</span>
     
    Ryan Stewart, Mar 3, 2004
    #3
  4. Anders Christiansen

    Chris Morris Guest

    "Ryan Stewart" <> writes:
    > "Anders Christiansen" <> wrote in message
    > news:c24ito$116q$...
    > > This is most likely dead simple.. i just can't get it to work.
    > >
    > > I want difrent color highlight on diffrent parts of my text. I want the
    > > color of the text to be the same..
    > >
    > > I hope someone can help me.

    >
    > <p style="color: red;">This is <span style="background-color: blue;">some
    > blue stuff and this is</span> <span style="background-color: green;">some
    > green stuff.</span>


    Remember that not every browser can display colour (and not every
    person can distinguish colours well), so make sure if it's used for
    essential information, there's another way to get at the information
    too.

    --
    Chris
     
    Chris Morris, Mar 3, 2004
    #4
  5. I think i was misunderstood.

    What i want is a text all in black, that when i mark it with the mouse shows
    diffrent colors.. e.g.

    this is a test <br><br>

    When marked with the mouse it should look like this<br><br>

    <span style="background-color: blue;"> <font color=red>this is <font color=
    white>a test </span>



    "Ryan Stewart" <> skrev i en meddelelse
    news:...
    > "Anders Christiansen" <> wrote in message
    > news:c24ito$116q$...
    > > This is most likely dead simple.. i just can't get it to work.
    > >
    > > I want difrent color highlight on diffrent parts of my text. I want the
    > > color of the text to be the same..
    > >
    > > I hope someone can help me.
    > >
    > > Regards Anders Christiansen
    > >

    > <p style="color: red;">This is <span style="background-color: blue;">some
    > blue stuff and this is</span> <span style="background-color: green;">some
    > green stuff.</span>
    >
    >
     
    Anders Christiansen, Mar 3, 2004
    #5
  6. Anders Christiansen wrote:

    > What i want is a text all in black, that when i mark it with the mouse shows
    > diffrent colors.. e.g.


    Can't be done. Mouse selection colour is entirely chosen by the visitor.

    CSS3 may change that (it's introducing a few irritating things along those
    lines, though I've not searched for that specifically.)

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Mar 3, 2004
    #6
  7. Anders Christiansen schrieb:
    > I think i was misunderstood.
    >
    > What i want is a text all in black, that when i mark it with the mouse shows
    > diffrent colors.. e.g.
    >
    > this is a test <br><br>
    >
    > When marked with the mouse it should look like this<br><br>
    >
    > <span style="background-color: blue;"> <font color=red>this is <font color=
    > white>a test </span>


    I don't know exactly why you want to achieve this, but you could set
    some dummy link in order to achieve this (it's quirk however):

    a.highlight {
    text-decoration:none;
    }
    a.highlight:link {
    color:red;
    }
    a.highlight:hoover {
    color:white;
    }

    <span style="background-color:blue;color=red;">this is<a
    href="javascript:;" class="highlight">a test</a></span>

    but I don't know if it's what you want :)


    bernhard
    ---
    www.daszeichen.ch
    remove nixspam to reply
     
    Bernhard Sturm, Mar 3, 2004
    #7
  8. Ryan Stewart wrote:
    > <p style="color: red;">This is <span style="background-color: blue;">some
    > blue stuff and this is</span> <span style="background-color: green;">some
    > green stuff.</span>


    Browsers may default paragraphs to having a red background, in which
    case your text would become invisible. You should always set background
    when setting color, and always set color when setting background.
     
    Leif K-Brooks, Mar 3, 2004
    #8
  9. Anders Christiansen

    Ryan Stewart Guest

    "Leif K-Brooks" <> wrote in message
    news:RLr1c.98$...
    > Ryan Stewart wrote:
    > > <p style="color: red;">This is <span style="background-color:

    blue;">some
    > > blue stuff and this is</span> <span style="background-color:

    green;">some
    > > green stuff.</span>

    >
    > Browsers may default paragraphs to having a red background, in which
    > case your text would become invisible. You should always set background
    > when setting color, and always set color when setting background.


    I'd assumed he would account for that, but yes, it's good to point out.
     
    Ryan Stewart, Mar 3, 2004
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Randy

    TextBox changing colors

    Randy, Oct 26, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    376
    =?Utf-8?B?Q3VydF9DIFtNVlBd?=
    Oct 26, 2005
  2. No spam
    Replies:
    0
    Views:
    551
    No spam
    Mar 4, 2005
  3. Matt
    Replies:
    2
    Views:
    456
    Kevin Goodsell
    Aug 26, 2003
  4. AAaron123

    TreeNode colors come from anchor colors

    AAaron123, Aug 7, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    558
    darrel
    Aug 7, 2008
  5. ZelluX
    Replies:
    3
    Views:
    1,940
    Peter Otten
    Dec 1, 2008
Loading...

Share This Page