As you might expect, the border-top-style, border-right-style, border-bottom-style, and border-left-style properties allow you to
specify a border style to one side of the element. If you do not
specify a width for the border, the medium width value (the default) will be
used. If there is no color specified, it uses the foreground color of
the element (i.e., the text color). This example shows single-side
border attributes in action (Figure 19-8).
div {border-top-style: solid;
border-right-style: dashed;
border-bottom-style: dotted;
border-left-style: double; }
Figure 19-8. The border-style property
The border-style shortcut
property works the same as the margin shortcut described earlier. Border
style values for each side are provided in clockwise order: top,
right, bottom, left. If fewer values are provided, some values are
replicated. The right value will be used for a missing left value, the
top value will be replicated for a missing bottom value; and if only
one border style is provided, it will be applied to all four sides of
the element.
The same effect shown in Figure 19-8 can be replicated
using this border-style
declaration:
div {border-style: solid dashed dotted double; }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