Span for text colour change?

Discussion in 'CSS' started by wizardswitch, Aug 8, 2007.

  1. #1
    Hello,

    I've been teaching myself XHTML/CSS and I've learned a lot but for some reason I can't seem to change a font color at the end of a paragraph. Can anybody help? I've tried using spans but for some reason I can't get it to work.

    Basically I want to change the price in brackets to blue:

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean sollicitudin. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. ($5.00)

    Any advice would be appreciated. Thanks everyone!
     
    wizardswitch, Aug 8, 2007 IP
  2. euler

    euler Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean sollicitudin. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. <span style="color:#0000FF;">($5.00)</span></p>
    Code (markup):
     
    euler, Aug 8, 2007 IP
  3. wizardswitch

    wizardswitch Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for that it works fine. I'm using external style sheets so I've been trying to do this without putting any CSS in the XHTML, e.g.

    <span class="blue">($5.00)</span>

    .blue { color: #0000FF; }

    But I can't get this to work. Am I doing something wrong?
     
    wizardswitch, Aug 8, 2007 IP
  4. euler

    euler Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    that's odd, try this
    ...
    <style>
    <!--
    .blue {
    color: #0000FF;
    }
    -->
    </style>
    </head>
    
    <body>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    Aenean sollicitudin.Pellentesque habitant morbi tristique
    senectus et netus et malesuada fames ac turpis egestas.
    <span class="blue">($5.00)</span></p>
    </body>
    </html>
    Code (markup):
     
    euler, Aug 8, 2007 IP
  5. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #5
    I would check to see if you have a ID or a !important declaration that could be overriding that class in the css.
     
    deathshadow, Aug 8, 2007 IP