When it comes to customizing your site, font color frequently gets disregarded. In virtually cases, website owners leave the default font color like black or whatever their theme styles have defined for the torso and heading text color.

Still, it'southward a good idea to change the HTML font color on your website for several reasons. Changing the HTML font colour might seem daunting, just it's pretty simple. There are several ways to change the font color on your website.

In this post, we'll show you different means to modify the color of your website fonts, as well as hash out why you'd want to do it in the first place.

Why Change the HTML Font Color?

Y'all would desire to change the font color because doing so tin can aid better your website's readability and accessibility. For example, if your site uses a darker color scheme, leaving the font color black would arrive difficult to read the text on your website.

Some other reason y'all would want to consider changing the font color is if you're going to employ a darker color from your make colour palette. This is yet another opportunity to reinforce your brand. It builds brand consistency and ensures that the text across all your marketing channels looks the aforementioned.

With that out of the way, let'southward look at how y'all tin define and modify the HTML font color.

When it comes to customizing your site, font colour oftentimes gets overlooked... but it's a simple edit that tin add a lot of personality! ✨🎨 Click to Tweet

Ways To Define Color

There are several ways to ascertain colour in spider web design, including name, RGB values, hex codes, and HSL values. Allow's take a look at how they piece of work.

Color Name

Color names are the easiest way to define a colour in your CSS styles. The color name refers to the specific name for the HTML color. Currently, there are 140 color names supported, and yous tin can use any of those colors in your styles. For example, you can employ "blue" to set the colour for an individual element to blue.

HTML color names
HTML color names.

Still, the downside of this approach is that non all color names are supported. In other words, if you use a color that'southward not on the list of supported colors, you won't be able to apply it in your blueprint by its colour proper noun.

RGB and RGBA Values

Next up, we have the RGB and RGBA values. The RGB stands for Reddish, Light-green, and Blue. Information technology defines the color by mixing ruby-red, green, and bluish values, similarly to how you'd mix a colour on an bodily palette.

RGB values
RGB values.

The RGB value looks similar this: RGB(153,0,255). The first number specifies the ruddy color input, the second specifies the green color input, and the third specifies bluish.

The value of each color input can range between 0 and 255, where 0 means the color is not nowadays at all and 255 ways that the detail color is at its maximum intensity.

The RGBA value adds ane more than value to the mix, and that's the alpha value that represents the opacity. Information technology ranges from 0 (not transparent) to 1 (fully transparent).

HEX Value

HEX codes are another easy-to-use color selection option.
HEX codes are another easy-to-use color choice option.

The hex colour codes piece of work similarly to RGB codes. They consist of numbers from 0 to 9 and letters from A to F. The hex code looks like this: #800080. The starting time two messages specify the intensity of the crimson color, the middle two numbers specify the intensity of the green colour, and the last two set the intensity of the blue color.

HSL and HSLA Values

Another way to define colors in HTML is to use HSL values. HSL stands for hue, saturation, and lightness.

HSL color values 
HSL color values.

Hue uses degrees from 0 to 360. On a standard color cycle, blood-red is around 0/360, green is at 120, and blue is at 240.

Saturation uses percentages to ascertain how saturated the color is. 0 represents blackness and white, and 100 represents the full color.

Lastly, lightness uses percentages similarly to saturation. In this case, 0% represents blackness, and 100% represents white.

For example, the purple color nosotros've been using throughout this commodity would await like this in HSL: hsl(276, 100%, 50%).

HSL, like RGB, supports opacity. In that instance, you'd use the HSLA value where A stands for alpha and is defined in a number from 0 to ane. if we wanted to lower the opacity of the example purple, we'd utilise this code: hsl(276, 100%, 50%, .85).

Now that you know how to define color, let'southward look at different ways to change the HTML font color.

The Sometime: <font> Tags

Before HTML5 was introduced and set as the coding standard, you could modify the font colour using font tags. More than specifically, you'd employ the font tag with the color aspect to set up the text color. The colour was specified either with its name or with its hex code.

Here'southward an example of how this code looked with hex color code:

          <font color="#800080">This text is purple.</font>        

And this is how you could set up the text color to majestic using the color proper name.

          <font color="purple">This text is purple.</font>                  

However, the <font> tag is deprecated in HTML5 and is no longer used. Changing the font color is a design decision, and design is non the principal purpose of HTML. Therefore, it makes sense that the <font> tags are no longer supported in HTML5.

So if the <font> tag is no longer supported, how do you alter the HTML font colour? The respond is with Cascading Manner Sheets or CSS.

The New: CSS Styles

To change the HTML font color with CSS, y'all'll use the CSS color property paired with the appropriate selector. CSS lets you use color names, RGB, hex, and HSL values to specify the color. There are 3 ways to utilise CSS to change the font color.

Inline CSS

Inline CSS is added directly to your HTML file. Y'all'll use the HTML tag such as <p> and and so style it with the CSS color property similar and so:

          <p style="color: imperial">This is a majestic paragraph.</p>        

If you want to use a hex value, your code will wait like this:

          <p fashion="color:#800080">This is a purple paragraph.</p>        

If you're going to utilise the RGB value, you lot volition write it like this:

          <p style="color:RGB(153,0,255)">This is a purple paragraph.</p>        

Lastly, using the HSL values, you lot'd employ this code:

          <p mode="color:hsl(276, 100%, 50%)">This is a purple paragraph.</p>        

The examples above testify you lot how to modify the color of a paragraph on your website. Only you lot're non express to paragraphs alone. You can change the font color of your headings as well as links.

For example, replacing the <p> tag above with <h2> will change the color of that heading text, while replacing it with the <a> tag will change the color of that link. Y'all can also utilise the <span> element to color whatever amount of text.

Subscribe Now

If y'all want to change the background colour of the unabridged paragraph or a heading, it'due south very like to how you'd alter the font colour. You have to use the background-colour attribute instead and use either the colour name, hex, RGB, or HSL values to set up the color. Here's an example:

          <p way="groundwork-color: purple">        

Embedded CSS

Embedded CSS is within the <style> tags and placed in betwixt the head tags of your HTML certificate.

The code will wait similar this if you desire to use the colour proper name:

          <!DOCTYPE html> <html> <caput>   <style>     <p> {         color: purple;     } </mode> </head>        

The code in a higher place will alter the colour of every paragraph on the page to royal. Like to the inline CSS method, you can apply different selectors to modify the font color of your headings and links.

If y'all want to utilise the hex lawmaking, here'southward how the lawmaking would look:

          <!DOCTYPE html> <html> <head>   <style>     <p> {         color: #800080;     }   </manner> </caput>        

The example below uses the RBGA values so you can see an instance of setting the opacity:

          <!DOCTYPE html>  <html>  <caput>  <style>  <p> {  color: RGB(153,0,255,0.75),  }  </fashion>  </head>        

And the HSL code would look similar this:

          <!DOCTYPE html> <html> <head>   <style>     <p> {         color: hsl(276, 100%, 50%),     }   </style> </head>        

External CSS

Lastly, you can use external CSS to change the font color on your website. External CSS is CSS that's placed in a separate stylesheet file, usually called style.css or stylesheet.css.

This stylesheet is responsible for all the styles on your site and specifies the font colors and font sizes, margins, paddings, font families, background colors, and more. In brusque, the stylesheet is responsible for how your site looks visually.

To alter the font color with external CSS, you'd use selectors to manner the parts of HTML you want. For example, this lawmaking will change all body text on your site:

          body {colour: imperial;}        

Remember, yous tin can use RGB, hex, and HSL values and not just the color names to alter the font color. If you desire to edit the stylesheet, it's recommended to do so in a lawmaking editor.

Inline, Embedded, or External?

So now y'all know how you can utilize CSS to change the font color. But which method should you utilise?

If you utilise the inline CSS code, you'll add it directly into your HTML file. Generally speaking, this method is suitable for quick fixes. If yous want to change the color of one specific paragraph or heading on a unmarried page, this method is the fastest and the to the lowest degree complicated way to do it.

Withal, inline styles tin make the size of your HTML file bigger. The bigger your HTML file is, the longer information technology will take for your webpage to load. In addition to that, inline CSS can make your HTML messy. As such, the inline method of using CSS to change the HTML font color is generally discouraged.

Embedded CSS is placed between the <head> tags and inside the <mode> tags. Like inline CSS, information technology'due south proficient for quick fixes and overriding the styles specified in an external stylesheet.

1 notable stardom between inline and embedded styles is that they will apply to whatever folio that the caput tags are loaded on, while inline styles apply only to the specific page they're on, typically the element they're targeting on that page.

The last method, external CSS, uses a dedicated stylesheet to ascertain your visual styles. Generally speaking, it's best to use an external stylesheet to keep all your styles in a single place, from where they are easy to edit. This also separates presentation and design, and so the lawmaking is easy to manage and maintain.

Proceed in mind that inline and embedded styles can override styles set in the external stylesheet.

Font Tags or CSS Styles: Pros and Cons

The two master methods of changing the HTML font colors are to use the font tag or CSS styles. Both of these methods have their pros and cons.

HTML Font Tags Pros And Cons

The HTML font tag is easy to use, so that's a pro in its favor. Typically speaking, CSS is more complicated and takes longer to learn than typing out <font color="purple">. If yous have an older website that isn't using HTML5, then the font tag is a viable method of changing the font color.

Even though the font tag is easy to apply, you shouldn't use information technology if your website uses HTML. As mentioned before, the font tag was deprecated in HTML5. Using deprecated lawmaking should exist avoided equally browsers could end supporting it at any time. This can lead to your website breaking and non functioning correctly, or worse, non displaying at all for your visitors.

CSS Pros and Cons

CSS, like the font tag, has its pros and cons. The nearly pregnant advantage of using CSS is that information technology'due south the proper fashion to change font colour and specify all the other styles for your website.

As mentioned earlier, information technology separates presentation from design which makes your lawmaking easier to manage and maintain.

On the downside, CSS and HTML5 tin take fourth dimension to learn and write properly compared to the former manner of writing code.

Continue in mind that with CSS, you lot have dissimilar means of irresolute the font color, and each of those methods has its own set of pros and cons, equally discussed earlier.

Tips for Irresolute HTML Font Color

At present that you know how to change the HTML font color, here are a few tips that volition assist you out.

Apply A Color Picker

Color pickers streamline the color selection process.
Color pickers streamline the color pick process.

Instead of picking colors randomly, use colour pickers to select the right colors. The benefit of a colour picker is that it will give you the colour proper name and the correct hex, RGB, and HSL values that you need to utilise in your code.

Check the Contrast

Use a contrast checker to test various text-to-background color contrast ratios.
Use a contrast checker to test diverse text-to-background colour contrast ratios.

Dark text with dark groundwork equally well as light text with light groundwork doesn't work well together. They will brand the text on your site hard to read. Nonetheless, yous tin utilise a contrast checker to ensure your site'due south colors are accessible and the text is easy to read.

Find the Color Using the Inspect Method

Using Inspect to find color codes.
Using Audit to detect color codes.

If you run into a colour that y'all similar on a website, you can audit the lawmaking to go the color's hex, RGB, or HSL value. In Chrome, all you have to do is indicate your cursor to the part of the spider web page you want to audit, right-click and select Inspect. This volition open up up the code inspection panel, where you tin can see a website's HTML lawmaking and the corresponding styles.

Want to modify the font color on your site? 🎨 It's simple! This guide will assist you get started ⬇️ Click to Tweet

Summary

Irresolute the HTML font color tin can help ameliorate your website's readability and accessibility. It can also help yous establish brand consistency in your website styles.

In this guide, you've learned about four different ways to change the HTML font colour: with color names, hex codes, RGB, and HSL values.

We've also covered how you tin modify the font color with inline, embedded, and external CSS and use the font tag and the pros and cons of each method. By now, yous should take a good agreement of which method you should use to change the HTML font color, then the only affair left to do now is to implement these tips on your site.

What are your thoughts on changing the font colour with CSS and font tag? Let us know in the comments department!


Relieve time, costs and maximize site performance with:

  • Instant help from WordPress hosting experts, 24/7.
  • Cloudflare Enterprise integration.
  • Global audience reach with 29 data centers worldwide.
  • Optimization with our born Application Functioning Monitoring.

All of that and much more, in ane plan with no long-term contracts, assisted migrations, and a thirty-day-money-back-guarantee. Bank check out our plans or talk to sales to detect the plan that's correct for you lot.