For instance, If you have a paragraph and you want one word in that paragraph to be a different color than the rest of its elements, how would you do that using CSS?
The above answer can only change the color of the whole paragraph, not conveniently one word… if you did that anyway each word would be a new paragraph. Sorry!
However, there are MANY ways to do it with CSS. Here are some examples, you can try each of them out with this HTML editor: (just delete the code that’s already on there).
I’m using CSS to edit the tag. In HTML, doesn’t do anything! But with CSS it can be especially useful in this case.
span {color: RED;}
Text text text text red text
– – – – – – – – – – – – – – –
span {color:#FF0000; font-weight:BOLD;}
Text text text text red bold text
– – – – – – – – – – – – – – –
p {font: italic 10px Verdana;}
span {color:BROWN; font-weight:BOLD; text-decoration:UNDERLINE; font-variant:SMALL-CAPS;}
Any paragraph using this style will be italicized, size 10px, and font face Verdana. In addition to that, the text nested here will ALSO be brown, bold, underlined, and capitalized.
– – – – – – – – – – – – – – –
If you have multiple words that you want all to be different from each other, here is what you do:
Text text text The word you put in here will be RED text text text here will be GOLD text text text and here will be ORANGE.
As you can see, you can edit a lot more than just colors, size, font weight etc. You can use a CSS guide that can tell you all the stuff you can do to edit a font. Good luck!
January 23rd, 2007 at 9:41 pm
use this code:
your paragraph here
change #FFFFFF to the color that you want.
January 25th, 2007 at 11:19 am
The above answer can only change the color of the whole paragraph, not conveniently one word… if you did that anyway each word would be a new paragraph. Sorry!
However, there are MANY ways to do it with CSS. Here are some examples, you can try each of them out with this HTML editor: (just delete the code that’s already on there).
I’m using CSS to edit the tag. In HTML, doesn’t do anything! But with CSS it can be especially useful in this case.
span {color: RED;}
Text text text text red text
– – – – – – – – – – – – – – –
span {color:#FF0000; font-weight:BOLD;}
Text text text text red bold text
– – – – – – – – – – – – – – –
p {font: italic 10px Verdana;}
span {color:BROWN; font-weight:BOLD; text-decoration:UNDERLINE; font-variant:SMALL-CAPS;}
Any paragraph using this style will be italicized, size 10px, and font face Verdana. In addition to that, the text nested here will ALSO be brown, bold, underlined, and capitalized.
– – – – – – – – – – – – – – –
If you have multiple words that you want all to be different from each other, here is what you do:
.wordone {color:RED;}
.wordtwo {color:GOLD;}
.wordthree {color:ORANGE;}
Text text text The word you put in here will be RED text text text here will be GOLD text text text and here will be ORANGE.
As you can see, you can edit a lot more than just colors, size, font weight etc. You can use a CSS guide that can tell you all the stuff you can do to edit a font. Good luck!
January 25th, 2007 at 6:45 pm
Using CSS, for example
.nt {
font 12px Arial;
color : blue;
margin-left : 10px;
margin-top 6px;
}
.gr {
color : green;
}
In the body:
This text will be blue, however
This text will have all the properties of class “nt” but the Color will be green
Be sure to place the “gr” *after* the nt