HTML and CSS Reference
In-Depth Information
You can also use any of the CSS border styles to borders to an image. In HTML5, the
border attribute has been removed.
Using Color
As you've seen, one way to add a splash of color to the black, gray, and white on your
web pages is to add images. Another is to change the colors of various elements on the
page. At one time, HTML attributes were used to specify the colors for various attributes
on web pages, but these days, colors should be specified using CSS.
Specifying Colors
Before you can change the color of any part of an HTML page, you have to know what
color you're going to change it to. There are three ways to specify colors using CSS, but
only two of them work when you're using HTML.
Using a hexadecimal number representing that color
Specifying the shades of red, green, and blue as numbers or percentages
Using one of a set of predefined color names
The most flexible and widely supported method of specifying a color is to use the hexa-
decimal identifier. Most image-editing programs have what's called a color picker —a
tool for choosing a single color from a range of available colors. Most color pickers can
be configured to display the value of that color in RGB form as three numbers represent-
ing the intensity of red, green, and blue in that color. Each number is usually 0 to 255,
with 0, 0, 0 being black and 255, 255, 255 being white. If you use one of these tools,
you'll have to convert the decimal numbers to hexadecimal. These days, most tools with
color pickers also provide the hexadecimal values for red, green, and blue, which is what
web browsers require. The color picker that's built in to the Mac OS includes the hexa-
decimal values to make things easy on web publishers.
If you want to use the regular decimal numbers, you can do so in CSS using the follow-
ing format:
rgb(0,0,0) /* Black */
rgb(255,255,255) /* White */
rgb(255,0,0) /* Red */
If you prefer, you can also use percentages:
rgb(0%,0%,0%) /* Black */
rgb(100%,100%,100%) /* White */
rgb(100%,0%,0%) /* Red */
Search WWH ::

Custom Search