Color in HTML (2024)

Colors in HTML can be specified using:

  1. a color name. HTML used to recognize 16 color names ("black", "white", "gray", "silver", "maroon", "red", "purple", "fushsia", "green", "lime", "olive", "yellow", "navy", "blue", "teal", and "aqua"), but new browsers can recognize 147 CSS3 color names.
  2. a color number, such as "#FF0000", "#FFFFFF" (those are red and white).

Color Numbers

Color numbers are specified using hexadecimal (base 16) values.

The hexidecimal digits are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
(where A through F equal the base 10 numbers: 10, 11, 12, 13, 14, 15)

The six digit color number is broken into three groups of two digits which specify the amount of Red, Green, and Blue in the color (using additive color...the way colored lights mix, not the way color pigments mix). Each two digit hex pair can have a value from 00 to FF (FF=256 in base 10). This gives over 16 million possible colors.

For example:

#FF0000 means FF worth of Red, and no Green or Blue. The result is RED.

#0000FF means no Red or Green, and FF worth of Blue. The result is BLUE.

#FFFF00 means FF worth of Red and Green, and Blue. The result is YELLOW.

#000000 means no Red, Green, or Blue. The result is BLACK.

#FFFFFF means full FF amounts of Red, Green, and Blue. The result is WHITE.

#FFEFD5 has high values for all colors, giving a light result: PAPAYAWHIP.
(no, I don't know who thought up the color names.)

#556B2F has lower values for all colors, giving a darker result: DARKOLIVEGREEN.

Note that is is OK to use either uppercase or lowercase letters for the base-16 digits A, B, C, D, E, F.

HTML also recognizes color numbers that contain just three hexidecimal digits. This is a shortcut for colors where the red, green, and blue values consist of two identical digits. Example:

#00F is the same as: #0000FF and is BLUE.

#FF0 is the same as: #FFFF00 and isYELLOW.

See Also
Hexadecimal

#6B5 is the same as: #66BB55 and is THIS COLOR.

#000 is BLACK. #FFF is WHITE.

#666 is a DARK GRAY. #AAA is a light LIGHT GRAY.

NOTE! Always remember to put in the # symbol when specifying color numbers. Older versions of HTML didn't care if you left it out, but some browsers are stricter about this, and f you forget the # sign the browser may not display the color you requested.

Web Safe Colors

Nowadays, computers/monitors can display thousands or millions of colors, so the concept of "Web safe colors" is no longer important. But years ago, many computers were limited to displaying "8-bit color" and could only show 256 possible colors. Even worse, different computer systems (PC, Mac, UNIX workstations) don't even use the same 256 colors in their "color palettes," so you couldn't be sure what your color will be shifted to.

To avoid problems for older machines and different system color palettes, early Web designers usually limited their color choices to the 216 "web safe colors" which would display more or less the same on all systems. The web safe colors use only the hex values 00, 33, 66, 99, CC, and FF when making color combinations.

Of the examples shown earlier,

#FFEFD5 (PAPAYAWHIP)and

#556B2F (DARKOLIVEGREEN)

...are not web safe colors. They would get shifted to

#FFFFCC (NOT PAPAYAWHIP)and

#666633 (NOT DARKOLIVEGREEN)

...on ancient systems.

Below are six tables showing all of the 216 "web safe" colors, just to show you a range of colors compared to their hex values.

Within each table, red increases from left to right, and green increases from top to bottom, in steps of 33 (hex).

Blue increases from the first table to the last, in steps of 33 (hex).

#000000#330000#660000#990000#CC0000#FF0000
#003300#333300#663300#993300#CC3300#FF3300
#006600#336600#666600#996600#CC6600#FF6600
#009900#339900#669900#999900#CC9900#FF9900
#00CC00#33CC00#66CC00#99CC00#CCCC00#FFCC00
#00FF00#33FF00#66FF00#99FF00#CCFF00#FFFF00

#000033#330033#660033#990033#CC0033#FF0033
#003333#333333#663333#993333#CC3333#FF3333
#006633#336633#666633#996633#CC6633#FF6633
#009933#339933#669933#999933#CC9933#FF9933
#00CC33#33CC33#66CC33#99CC33#CCCC33#FFCC33
#00FF33#33FF33#66FF33#99FF33#CCFF33#FFFF33

#000066#330066#660066#990066#CC0066#FF0066
#003366#333366#663366#993366#CC3366#FF3366
#006666#336666#666666#996666#CC6666#FF6666
#009966#339966#669966#999966#CC9966#FF9966
#00CC66#33CC66#66CC66#99CC66#CCCC66#FFCC66
#00FF66#33FF66#66FF66#99FF66#CCFF66#FFFF66

#000099#330099#660099#990099#CC0099#FF0099
#003399#333399#663399#993399#CC3399#FF3399
#006699#336699#666699#996699#CC6699#FF6699
#009999#339999#669999#999999#CC9999#FF9999
#00CC99#33CC99#66CC99#99CC99#CCCC99#FFCC99
#00FF99#33FF99#66FF99#99FF99#CCFF99#FFFF99

#0000CC#3300CC#6600CC#9900CC#CC00CC#FF00CC
#0033CC#3333CC#6633CC#9933CC#CC33CC#FF33CC
#0066CC#3366CC#6666CC#9966CC#CC66CC#FF66CC
#0099CC#3399CC#6699CC#9999CC#CC99CC#FF99CC
#00CCCC#33CCCC#66CCCC#99CCCC#CCCCCC#FFCCCC
#00FFCC#33FFCC#66FFCC#99FFCC#CCFFCC#FFFFCC

#0000FF#3300FF#6600FF#9900FF#CC00FF#FF00FF
#0033FF#3333FF#6633FF#9933FF#CC33FF#FF33FF
#0066FF#3366FF#6666FF#9966FF#CC66FF#FF66FF
#0099FF#3399FF#6699FF#9999FF#CC99FF#FF99FF
#00CCFF#33CCFF#66CCFF#99CCFF#CCCCFF#FFCCFF
#00FFFF#33FFFF#66FFFF#99FF9FF#CCFFFF#FFFFFF
Color in HTML (2024)

FAQs

How do you put color in HTML? ›

HTML tags allow you many methods of incorporating color into your web document. You can set the main colors of the page using the <body> tag, you can alter the color of text with the <font> tag and you have control of table's cells and rows' colors as well.

What is the color code in HTML? ›

A HTML color code is an identifier used to represent a color on the web. Color codes are ways of representing the colors we see everyday in a format that a computer can interpret and display. Commonly used in websites and other software applications, there are a variety of formats.

What are the colors of text in HTML? ›

HTML used to recognize 16 color names ("black", "white", "gray", "silver", "maroon", "red", "purple", "fushsia", "green", "lime", "olive", "yellow", "navy", "blue", "teal", and "aqua"), but new browsers can recognize 147 CSS3 color names. a color number, such as "#FF0000", "#FFFFFF" (those are red and white).

How is color represented in HTML? ›

Colors are coded as red, green and blue intensities in hexadecimal notation (see hex chart). The first two characters represent the values 0 through 255 for red in hex; the middle two for green and the last two for blue (RRGGBB). For example, FF is equal to 255.

How do you add a color to a page in HTML? ›

You can use the bgColor attribute, like bgColor="#6B6B6B" , in the body element to change the background-color of <body> . The HTML bgcolor attribute is used to set the background color of an HTML element.

How to write a color code? ›

Hex color codes start with a pound sign or hashtag (#) and are followed by six letters and/or numbers. The first two letters/numbers refer to red, the next two refer to green, and the last two refer to blue. The color values are defined in values between 00 and FF (instead of from 0 to 255 in RGB).

How to change text color in HTML and CSS? ›

Changing Inline Text Color in CSS

Simply add the appropriate CSS selector and define the color property with the value you want. For example, say you want to change the color of all paragraphs on your site to navy. Then you'd add p {color: #000080; } to the head section of your HTML file.

How to change text color? ›

You can change the color of text in your Word document. Select the text that you want to change. On the Home tab, in the Font group, choose the arrow next to Font Color, and then select a color.

What color are HTML symbol codes? ›

Meaning of symbols:

The first two symbols in HTML color code represents the intensity of red color. 00 is the least and FF is the most intense. The third and fourth represents intensity of green and fifth and sixth represents the intensity of blue.

How to put color in HTML? ›

The most common way of coloring HTML text is by using hexadecimal color codes (Hex code for short). Simply add a style attribute to the text element you want to color – a paragraph in the example below – and use the color property with your Hex code.

Is there a color attribute in HTML? ›

We can use the color attribute of the font tag to set a font color in HTML. We can assign a color value using a color name, hex code, or RGB code.

How to get color from HTML? ›

Property Values

Specifies a color for the color picker. The value must be a hexadecimal (hex) value: 3 double digit numbers, starting with a # sign (like #FF8040). Note: Color keywords (like "red" or "blue") are not allowed. Note: Default color is #000000 (black).

How do you make a color input in HTML? ›

<input type="color"> <input> elements of type color provide a user interface element that lets a user specify a color, either by using a visual color picker interface or by entering the color into a text field in #rrggbb hexadecimal format.

How do you add a color line in HTML? ›

The HTML <hr> color Attribute is used to specify the color of a Horizontal rule. This attribute accepts color values in various formats, including color names, hexadecimal codes, or RGB values.

Top Articles
Roth IRA Rules + Contribution Limits [2024 Update]
9 Secrets of Becoming a Self-Made Millionaire (on a Low Income)
WALB Locker Room Report Week 5 2024
Foxy Roxxie Coomer
Wizard Build Season 28
PontiacMadeDDG family: mother, father and siblings
Aiken County government, school officials promote penny tax in North Augusta
Beds From Rent-A-Center
Jesse Mckinzie Auctioneer
Es.cvs.com/Otchs/Devoted
Herbalism Guide Tbc
Slmd Skincare Appointment
Immediate Action Pathfinder
Blog:Vyond-styled rants -- List of nicknames (blog edition) (TouhouWonder version)
Summoners War Update Notes
What Happened To Anna Citron Lansky
Fraction Button On Ti-84 Plus Ce
Pretend Newlyweds Nikubou Maranoshin
Foxy Brown 2025
Beryl forecast to become an 'extremely dangerous' Category 4 hurricane
Ruse For Crashing Family Reunions Crossword
Schedule An Oil Change At Walmart
Wemod Vampire Survivors
Restored Republic June 16 2023
3 Ways to Drive Employee Engagement with Recognition Programs | UKG
130Nm In Ft Lbs
Kiddie Jungle Parma
100 Million Naira In Dollars
UPC Code Lookup: Free UPC Code Lookup With Major Retailers
1475 Akron Way Forney Tx 75126
Ilabs Ucsf
Pch Sunken Treasures
Rocksteady Steakhouse Menu
Ma Scratch Tickets Codes
Navigating change - the workplace of tomorrow - key takeaways
Maybe Meant To Be Chapter 43
No Hard Feelings Showtimes Near Tilton Square Theatre
Hannibal Mo Craigslist Pets
Game8 Silver Wolf
Winco Money Order Hours
968 woorden beginnen met kruis
Nami Op.gg
Payrollservers.us Webclock
Vérificateur De Billet Loto-Québec
Watch Chainsaw Man English Sub/Dub online Free on HiAnime.to
4k Movie, Streaming, Blu-Ray Disc, and Home Theater Product Reviews & News
Timothy Warren Cobb Obituary
Frequently Asked Questions
Willkommen an der Uni Würzburg | WueStart
Blog Pch
Image Mate Orange County
Cataz.net Android Movies Apk
Latest Posts
Article information

Author: Arline Emard IV

Last Updated:

Views: 5821

Rating: 4.1 / 5 (72 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Arline Emard IV

Birthday: 1996-07-10

Address: 8912 Hintz Shore, West Louie, AZ 69363-0747

Phone: +13454700762376

Job: Administration Technician

Hobby: Paintball, Horseback riding, Cycling, Running, Macrame, Playing musical instruments, Soapmaking

Introduction: My name is Arline Emard IV, I am a cheerful, gorgeous, colorful, joyous, excited, super, inquisitive person who loves writing and wants to share my knowledge and understanding with you.