Chapter 9. Colors and Backgrounds
Most of us take color for granted. For web professionals, it’s a big heap of details. Experienced developers need to know how to relate color data to their literal counterparts, and the body of related knowledge gets trickier and more subjective from there. Web color is about the numbers and the art, and it never hurts to understand the two together.
Backgrounds offer challenges of their own. Assigning a flat background color to an element is a straightforward task, but once images enter the picture the implementation questions start to multiply.
Note
This book doesn’t cover web color and graphics in depth, but there are plenty of good resources out there. A number of sites are linked from this book’s companion site. I also recommend the following books:
Web Style Guide, Third Edition, by Sarah Horton and Patrick Lynch (Yale University Press)
Painting the Web by Shelley Powers (O’Reilly)
Color Theory and Web Color Practice
The CSS 2.1 properties that can take color values are the various background and
border properties. There’s also the color property, which
sets the text and underline colors of the elements to which it is
applied.
Usability, Accessibility, and Color
When assigning colors and background colors to two elements, adhere to the following:
Where
backgroundorbackground-coloris used in a stylesheet rule,colorshould follow—and a background color reference should always precede acolorvalue. This prevents odd user agent or user stylesheet defaults ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access