

Html color hex code code#

Cascading Style Sheets: The Definitive Guide, 2d ed Newly updated for CSS 2.1, the second edition of this classic book explains how CSS works like no other. Cascading Style Sheets, level 2 CSS2 Specification The CSS specification, from the W3C. Further Reading CSS Home Page From the W3C CSS Optimization Summary of chapter on optimizing CSS from Speed Up Your Site: Web Site Optimization. When combined with shorthand properties, grouping, descendant, and high-level type selectors shorthand hex colors can help optimize your style sheets to their minimum size. Shorthand hex colors save three bytes for each color abbreviated. Shorthand hex notation substitutes 3-character color values for 6-character colors when each of the color channels is identical in an RRGGBB hex triplet. Web-safe colors can always be abbreviated using shorthand hex notation. So to create a web-safe color, use any combination of 00, 33, 66, 99, cc, and ff. Web-safe colors are expressed in multiples of 20% and 51 for RGB values, and 33 in hex.
Html color hex code Pc#
The so-called web-safe color cube consists of the 216 colors common to both PC and Mac platforms that display identically and don’t exhibit any color shift or dithering. Some named equivalents are shorter than their seven-character hex equivalents ( silver, gray, maroon, purple, olive, navy, and teal). Use shorthand hex colors wherever possible, unless the named equivalent is shorter ( red, for example).

The 16 named colors supported by the HTML and XHTML specifications are shown in Table 1. However in some cases named colors are shorter than their hex equivalents. In most cases using shorthand hex colors is the most efficient way to specify colors. This technique saves a few bytes for each color abbreviated with shorthand hex notation. orange īrowsers automatically expand these three-character colors into six by replicating the R, G, and B values. Hexadecimal colors come in two flavors: RGB triplets and shorthand. The two most efficient ways are hexadecimal and named colors. There are five ways to specify colors in CSS four use numeric RGB values and one uses named colors. Combined with shorthand properties and grouping, shorthand hexadecimal colors can shrink style sheets dramatically, often by 50%. Shorthand hex notation abbreviates 6-character RRGGBB CSS colors into 3-character RGB shorthand.
