Member Offer
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

2 different font colours

Discussion in 'Website Design Forum:' started by TomStutt, Nov 14, 2010.

  1. TomStutt

    TomStutt Senior Member

    Hi, this might sound dumb but never had to do it before.

    Is there a way of setting <p> to 2 different colours.


  2. Levi

    Levi Moderator Staff Member

    giving different id's or classes should work iirc and you could also add in the css before the block of text

    harry will likely come in with some fancy way of doing it though.........
  3. Thewholehogg

    Thewholehogg Active Member

    My p is usually the same colour....
  4. TomStutt

    TomStutt Senior Member

    i have some text to go on a white background so i want black text and i have some text to go on a purple background so i want white text.
  5. TomStutt

    TomStutt Senior Member

    i added a class like levi said and it works nice but if there is a better way to do it then please let me know. thanks all
  6. tbwcf

    tbwcf Active Member

    presumably the containers which have the background colours already have a class or an id and the paragraph is nested within them?

    In witch case .purple p {/*your styles*/} or .white p {/*your styles*/} ?
  7. glenwheeler

    glenwheeler Senior Member

    Hi Tom,

    You could change this depending on where the paragraph is? so...

    If the a paragraph is is an area called content it could be

    #content p {
    color: #fff;

    or if the a paragraph is in a side area

    #sidebar p {
    color: #000;

    or as levi said, use a class like

    <p class="red-text"> Blah blah</p>

    in the stylesheet you would have

    .red-text {
    color: #ff0000; /*red paragraph text */

Share This Page