Making part of a sentence a different colour
Ok this is basically what I'm after:
"This bit is black this bit is red and now it's back to black"
What's the best way to do this in xhtml strict 1.0? I need to do this both in tags (for a main description bit) and in
Do I just add tags around the bit I want coloured?... I'd rather keep formatting out of the main code though.
Cheers.
Megan posted this at 13:18 — 13th March 2007.
She has: 11,421 posts
Joined: Jun 1999
No, no, no font tags! No font tags ever.
The question you need to ask is this: Why is it red? Is it because it is strong or emphasized? If so, use or with a class that describes the purpose of the text. If there is no reason why the text is red, you can use a with a class to style it.
The class name should describe why it is red, not that it is red. So for example you could use instead of .
Megan
Connect with us on Facebook!
aka Rohan posted this at 08:45 — 14th March 2007.
He has: 200 posts
Joined: Feb 2006
Awesome, thanks guys. That works a treat
demonhale posted this at 00:30 — 14th March 2007.
He has: 3,278 posts
Joined: May 2005
To further megans explanation, it's like this...
"This bit is black this bit is red and now it's back to black"
on css:
p {color:#000;}
.alert {color: red;}
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.