5.6. Foreground and Background Properties

Style sheets support a powerful and convenient way of changing foreground colors, background colors, and background images for regions of text. Style sheets don't suffer from the problem of a color becoming invisible if the user overrides the author's settings on the BODY's BGCOLOR. Setting the BGCOLOR through a style sheet overrides the browser setting.

color

color-name | #RRGGBB | #RGB | rgb(rrr, ggg, bbb) | rgb(rrr%, ggg%, bbb%) This property specifies the color of text or the foreground color of the associated section, using any of the standard color designators (Table 5.2 in Section 5.11). For example,

 P { color : blue } H1 { color : #00AABB } H2 { color : #0AB } H3 { color : rgb(255, 0, 0 ) } /* ...

Get Core Web Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.