Setting the BorderYou can create a border around an element and then set its thickness, style, and color. If you've specified any padding (see page 176) the border encloses both the padding and the contents of the element. To define the border-style: Type border-style: type, where type is none, dotted, dashed, solid, double, groove, ridge, inset, or outset. Figure 11.44. When you make a link out of an img element, the image is displayed with a blue border by default in most browsers. In this example, it's easier to remove the border from the img element than from a elements, though we could do that, too.
To set the width of the border: Type border-width: n, where n is the desired width, including abbreviated units (for example, 4px). To set the color of the border: Type border-color: color, where color is a color name or rgb color (see page 126 and the inside back cover). Figure 11.45. Notice that since a right border is applied to the entry div and not the main div, it stops and starts for each entry. Also, now that the photos don't have that annoying default border, there is enough space between them and the text.
To set one or more border properties at once with a shortcut:
Figure 11.46. The footer has a top border that is the same color but that is dotted instead of dashed.
Tips
Figure 11.48. Firefox for Macintosh is shown on the left, IE 7 for Windows is on the right. The styles are very similarly displayed, but not exactly the same. Note, for example, how IE's dots are actually round and how Firefox's shading is lighter and more pronounced.
|