vngx
1
Hi there
I want to change font color of a particular element using CSS style how can I do this?
I know I can do this like
<p><font color="red">This is some text!</font></p>
<p><font color="blue">This is some text!</font></p>
but i want a global css that will change color of an element whenever it is in document?
Thanks
CSS
.classname {color: red;}
.anothername {color: blue;}
HTML
<p class="classname">This text will be red.</p>
<p class="anothername">This text will be blue.</p>
(Obviously, you choose class names whoich are meaningful in the context of your site. )
2 Likes
SamA74
4
You can set the default for any element, such as āpā then use a class only where wanted.
CSS
p { color: red; }
.blue { color: blue; }
HTML
<p>A paragraph in red by default.</p>
<p class="blue">A paragraph that is blue.</p>
system
Closed
6
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.