Chapter 12. Colors and Images


  • Web color basics

  • Other means to specify colors

  • The evolution of color on the Web

  • Using proper means to specify colors

  • Image formats for the Web

  • Creating graphics

  • Inserting an image

  • Image alignment

  • Specifying text to display for nongraphical browsers

  • Sizing an image

  • Image borders

  • Image maps

  • Animated images

The Web is not a black-and-white place. In fact, it never has been — the Web and HTML language was born with 16 named colors and blossomed quickly into more than 200 supported colors. So, although it had its share of graphical growing spurts, unlike most of the other information mediums, the Web didn't have to grow out of a colorless beginning.

This chapter covers the various colors you can use for fonts, borders, backgrounds, and more. It also covers the image tag, which can be used to insert graphical images into your documents.

Web Color Basics

When the Web was first conceived, most computers were not capable of displaying the multitude of colors possible today. Most computers in that era supported a maximum of 16 colors (via Enhanced Graphics Adapter [EGA]), or a few years later, 256 colors (via Video Graphics Array [VGA]).

To create an initial, standard color palette, the World Wide Web Consortium created a color palette of 16 named colors: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow. These color names are still the only color names that will properly validate against HTML 4.

Get HTML, XHTML, and CSS Bible, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.