Skip to Content

How to do HTML color code?

How to do HTML color code?


You can set the default text color for the entire body using:



The Tag (Deprecated)

The tag allows changing the color of text enclosed in it. For example:

This text will be green.

However, the tag is deprecated and should be avoided.

Background Color

In addition to text colors, you can change background colors of elements using the `background-color` property:


This background will be blue.


Common ways to apply background colors:

– The `style` attribute
– The `

` tag
– A CSS stylesheet

Background colors are useful for design accents and visual organization.

Color Design Tips

Here are some tips for effectively using color in web design:

– **Use color schemes** – Use premade color schemes or palette generators to pick colors that go well together.

– **Limit your palette** – Stick to 1-3 primary colors for consistent design. Too many colors looks uncoordinated.

– **Consider accessibility** – Ensure colors have enough contrast for readability. Avoid conveying information with color alone.

– **Use colors appropriately** – Use cool blues and greens for calmness, warm reds and oranges for excitement, etc.

– **Test on multiple monitors** – Colors can vary between displays. Always test websites on different devices.

Tools for Working with Colors

There are many helpful tools for working with colors in web design:

Tool Description
Adobe Color Create and browse color combinations from Adobe’s library.
Coolors Generate attractive color schemes with space to save your palettes.
WebAIM Contrast Checker Test color combinations for accessibility based on WCAG standards.
ColorZilla Advanced color picker browser extension. Finds the codes for any color on a webpage.

These tools help take the guesswork out of working with colors.


Colors are a creative way to spice up web design and engage visitors. With HTML, you can use color names, RGB, HEX, HSL, and more to apply color to text, backgrounds, and other elements. Make sure to design with accessibility in mind. Additionally, generators and color pickers help streamline the process for finding appealing palettes. With all these techniques at your disposal, you have endless possibilities to make use of color in HTML.