
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. NOTE! Always remember to put in the # symbol when specifying color numbers. #6 B 5 is the same as: #66 BB 55 and is THIS COLOR. #F F 0 is the same as: #FF FF 00 and is YELLOW. #0 0 F is the same as: #00 00 FF and is BLUE. This is a shortcut for colors where the red, green, and blue values consist of two identical digits. HTML also recognizes color numbers that contain just three hexidecimal digits. Note that is is OK to use either uppercase or lowercase letters for the base-16 digits A, B, C, D, E, F. #55 6B 2F has lower values for all colors, giving a darker result: DARKOLIVEGREEN. (no, I don't know who thought up the color names.) #FF EF D5 has high values for all colors, giving a light result: PAPAYAWHIP. #FF FF FF means full FF amounts of Red, Green, and Blue. #FF FF 00 means FF worth of Red and Green, and Blue. #00 00 FF means no Red or Green, and FF worth of Blue. #FF 00 00 means FF worth of Red, and no Green or Blue. This gives over 16 million possible colors. Each two digit hex pair can have a value from 00 to FF (FF=256 in base 10). 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). a color number, such as "#FF0000", "#FFFFFF" (those are red and white).Ĭolor numbers are specified using hexadecimal (base 16) values.

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. Imagine that you wanted to reverse that, though, to white text on a black background.

It looks like this: background-color: black įor example, let's consider another simple element: Here is a different paragraphĪgain, if you were to load this element on a webpage, you'd see black text on a white background.

If you want to color the rest of webpage-as in, the parts of your HTML elements that aren't text-you'll need to use the background-color CSS declaration instead. Text isn't the only thing worth coloring, of course. If applied to an HTML element that doesn't contain any text, it won't do anything. It doesn't change backgrounds, or outlines, or anything else. Keep in mind that the color declaration refers specifically to text.
