To change an element’s font color to blue, write {color: blue} for the element. You can target the element by CSS class name, ID, and even by tag name. If it’s a paragraph or <p> tag, then your CSS should be p{color: blue}

If it’s a certain element that has a CSS class of “apple“, then your CSS will be .apple {color: blue}

And if it has a CSS ID of “burger“, the CSS code will be #burger {color: blue}

You can also use the HEX color code for the blue color. The hex code for blue color is #0000FF

That means you can write the CSS like this {color: #0000FF} and this is the same as {color: blue}

The term “Attribute” has a different meaning in the web design context than in plain English. Anyways, there is no CSS or HTML attribute that can change an element’s font color to blue or green or something else. However, it’s the property (color property) that is responsible to make or change color. Use the following CSS to change the font color to blue:

selector{color: blue;}

/*here selector means the element you want to target*/

Related: Best Google font pairs.

If you like watching instead of reading, then see the video below:

Download the source code from the bottom of this page.

redesign old website
Advertisement

Change paragraph color to blue:

p{color: blue;}

/*or*/

p{color: #0000FF;}

Make a link blue:

a{color: blue;}

Change a specific attribute’s color to blue:

<p>This is an example of a target blank attribute <a href="#" target="_blank"> It is a link which has a target attribute</a>, and this is <a href="#">another link</a> without any target attribute</p>

<style>
    a{color: green;}

    a[target=_blank] {
        color: blue;
    }
</style>

This code will make all the link colors green except those with a target attribute with the value “_blank”. The link that contains the “target=_blank” attribute will be blue in color.

Make any element blue:

.exmclass p{color: blue;}

#idexm .exmclass span{color: blue;}

.exmclass h2{color: blue;}

Whatever element you want to change the color of, the CSS “color” property will do the trick. See other CSS properties on MDN.

Do you want to remove the underline from a link? See the post on how to remove the underline.

Download source code ↓

Hex color code picking tools:

  1. Browser based color picking
  2. Installable light weight software (Pixie)

FAQ

Which CSS property is used to change the text color of an element?

The “color” property is used to change the text color of an HTML element. For example, {color: red}

How do you change the font color with CSS?

Target the element by class name or ID or tag and apply the CSS “color” property. For example, #unicorn p {color: green}

How do you change font color in HTML?

You can change font color in HTML in two different ways: inline CSS & embedded CSS within <style> tag. An example of inline CSS, <p style=”color: red”>Example of inline CSS</p>
Example of embedded CSS, <style type=”text/css”>h2{color: yellow}</style>