HTML Colors: Choosing A Right Color Scheme for Your Website

HTML colors are an essential element of web design, and they can greatly impact the overall look and feel of your website.

In this guide, we’ll explore the different types of HTML colors and provide tips on how to choose the right color scheme for your website.

HTML Colors Type

HTML colors are specified using a combination of red, green, and blue values (RGB) or using a hexadecimal value (hex code), HSL, RGBA, or HSLA.

Colors play an essential role in giving your website a professional look and feel.

A <body> tag can set colors for the entire page, while the bgcolor attribute can identify colors for individual tags.

Following are the attributes that can be used to set the color of the <body> tag:

bgcolorDetermines the color of the page’s background.
textSpecifies the color of the body text.
alinkDetermines which links are active or which links are selected.
linkSpecifies the color of linked text.
vlinkColorizes visited links, or linked text that you’ve already clicked.

These examples illustrate how to set a tag’s background using a color name


<!DOCTYPE html> <html> <head> <title>HTML Colors</title> </head> <body text="red" bgcolor="yellow"> <p>Change the color names for the body and table and see what happens.</p> <table bgcolor="purple"> <tr> <td> <font color="white">White text will appear on purple background.</font> </td> </tr> </table> </body> </html>

Html Colors Name

These are predefined color names, such as red, green, blue, yellow, and so on.

These colors are easy to use and remember, but they are limited in number.

You can specify a color in HTML by using a color name. This means that instead of using the RGB or hexadecimal values, you can simply type in the name of the color you want to use.



<!DOCTYPE html> <html> <body><h1 style="background-color:LightCoral;">LightCoral</h1> <h1 style="background-color:LightSalmon;">LightSalmon</h1> <h1 style="background-color:DeepPink;">DeepPink</h1> <h1 style="background-color:Gold;">Gold</h1> <h1 style="background-color:Lavender;">Lavender</h1> <h1 style="background-color:LightGoldenrodYellowLightGoldenrodYellow;">LightGoldenrodYellow</h1> <h1 style="background-color:BlueVioletBlueViolet;">BlueViolet</h1> <h1 style="background-color:MediumSlateBlue;">MediumSlateBlue</h1></body> </html>

HTML supports 140 standard color names.

Background Color

You can set the background color of any HTML element, including the body of your page, using CSS.

There are several ways to specify a background color, including using color names, RGB values, and hexadecimal values.

When we talk about HTML colors, for HTML elements, you can set the background color as follows:

Hello World

Just like moons and like suns, With the certainty of tides, Just like hopes springing high,Still I’ll rise.

Did you want to see me broken?Bowed head and lowered eyes?Shoulders falling down like teardrops,Weakened by my soulful cries?

Does my haughtiness offend you?Don’t you take it awful hard’Cause I laugh like I’ve got gold minesDiggin’ in my own backyard.


<!DOCTYPE html> <html> <body><h1 style="background-color:DarkCyan;">Hello World</h1> <p style="background-color:SteelBlue;">Just like moons and like suns</p></body> </html>

Text Color

You want to make sure that your text is readable and legible against the background color you’ve chosen.

You can set the text color of any HTML element, including the body of your page

When we talk about HTML colors, text can be colored as follows:

Greeting! From Mr Examples

Did you want to see me broken?Bowed head and lowered eyes?Shoulders falling down like teardrops,Weakened by my soulful cries?

Does my haughtiness offend you?Don’t you take it awful hard’Cause I laugh like I’ve got gold minesDiggin’ in my own backyard.


<!DOCTYPE html> <html> <body><h1 style="color:Tomato;">Greeting! from mr examples</h1> <p style="color:DodgerBlue;">Are you having fun learning HTML ?</p> <p style="color:MediumSeaGreen;">Which is your favourite color ?</p></body> </html>

Border Color

If you want to change the color of the borders, you can do so as follows when it comes to HTML colors:

Greeting! from Mr Examples

We are learning about HTML colors

I hope you would find this article helpful


<!DOCTYPE html> <html> <body><h1 style="border:3px solid Aquamarine;">This shows an Aquamarine Border</h1> <h1 style="border:3px solid Pink;">Here we have used a pink border</h1> <h1 style="border:3px solid Black;">Black borders makes content visible</h1></body> </html>

HTML Color Values

RGB values, HEX values, HSL values, RGBA values, and HSLA values are all valid ways to specify colors in HTML colors.

Background colors for the next three <div> elements have been specified using RGB, HEX, and HSL values:

rgb(255, 99, 71)
hsl(9, 100%, 64%)

Background color for the following two <div> elements are described using RGBA and HSLA values, which give the colors an Alpha channel (in this case, 50% transparency):

rgba(255, 99, 71, 0.5)
hsla(9, 100%, 64%, 0.5)


<!DOCTYPE html> <html> <body><h1 style="background-color:rgb(255, 99, 71);">Mr Examples</h1> <h1 style="background-color:#ff6347;">Mr Examples</h1> <h1 style="background-color:hsl(9, 100%, 64%);">Mr Examples</h1> <h1 style="background-color:rgba(255, 99, 71, 0.5);">Mr Examples</h1> <h1 style="background-color:hsla(9, 100%, 64%, 0.5);">Mr Examples</h1></body> </html>

Choosing the Right Color Scheme

When choosing a color scheme for your website, there are several factors to consider, including your brand, your audience, and your website’s purpose.

Here are some tips to help you choose the right color scheme for your website:

  1. Your website’s color scheme should reflect your brand’s personality and values. If your brand is fun and playful, you may want to use bright, bold colors. If your brand is more professional and serious, you may want to use more muted colors.
  2. Your website’s color scheme should also appeal to your target audience. Consider the age, gender, and cultural background of your audience when choosing your colors.
  3. Different colors can evoke different emotions and feelings. For example, red is often associated with passion and energy, while blue is associated with calmness and trust. Use this knowledge to choose colors that will help convey the right message to your audience.
  4. Too many colors can be overwhelming and confusing. Stick to a maximum of three to four colors for your website’s color scheme.
  5. Once you’ve chosen your color scheme, test it to make sure it looks good on different devices and screen sizes. You may also want to get feedback from others to see if the colors are effective.


A website’s HTML colors play an important role in adding visual appeal and improving user experience. As HTML provides a wide range of color options, web developers can select colors that suit their content and the desired effect.

Furthermore, through the use of color, a brand’s image can be unified, emotions can be evoked, and meaning can be conveyed to the user.

You can make their web content stand out and capture their target audience’s attention by using color effectively.

It is possible to create visually stunning and engaging web pages with a basic understanding of HTML color codes and color theory. Next time you design a website, don’t forget to experiment with different color schemes and see how they affect the look and feel.

We value your feedback.

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!

Leave a Reply

Your email address will not be published. Required fields are marked *