HTML and CSS Reference
In another example, the size of a <div> element can be set to a specific value as in this
CSS provides very granular control over the styles of the borders of any HTML element. The
name of the root CSS property to do this is the border property. With the use of the border
property, you can control the style, spacing, color, and width of the border.
The first thing that you need to set on the border is the style. This will essentially bring
the border into existence. There are a variety of border styles that exists. These include, solid
border, dashed border, dotted line border, grooved line border, and so on. The border is set
by specifying the border-style property:
The color of the border can be changed by specifying the border-color property. This is
demonstrated with the following code:
All the <p> elements will now be displayed with a solid black border. This is demonstrated
in Figure 4-10.
FIGURE 4-10 A <p> element with border properties set
NOTE SETTING BORDER-STYLE
Note that the border needs to exist before it can have any visible changes done to it. This is
why in the above example, the border-style is set first.