2 different font colours


TomStutt

TomStutt

Senior Member
#1
Hi, this might sound dumb but never had to do it before.

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

thanks

Tom
 
Levi

Levi

Moderator
Staff member
#2
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.........
 
TomStutt

TomStutt

Senior Member
#4
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.
 
TomStutt

TomStutt

Senior Member
#5
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
 
tbwcf

tbwcf

Active Member
#6
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*/} ?
 
glenwheeler

glenwheeler

Senior Member
#7
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 */
}
 
Top