Padding, Borders, and Margins
The following properties control the space around an element, and let you add border lines to a style.
border
Draws a line around the four edges of an element.
Values: The width (thickness) of the border line in any valid CSS measurement unit (except percentages).
You can also specify a style for the line: solid, dotted, dashed, double, groove, ridge, inset, outset, none, and hidden. (See Figure 7-7 in Section 7.3 for an illustration of the different styles.) The none and hidden values do the same thing—remove any border.
Finally, you can specify a color using any valid CSS color type (a keyword like green or a hex number like #33fc44).
Example:
border: 2px solid #f33
;
border-top, border-right, border-bottom, border-left
Adds a border to a single edge. For example, border-top adds a border to the top of the element.
Values: same as for border.
Example:
border-left: 1em dashed red
;
border-color
Defines the color used for all four borders.
Values: Any valid CSS color type (a keyword like green or a hex number like #33fc44).
Example:
border-color: rgb(255,34,100
);
border-top-color, border-right-color, border-bottom-color, border-left-color
Functions just like the border-color property but sets color for only one edge. Use these properties to override the color set by the border property. In this way, you can customize the color for an individual edge while using a more generic border style to define the basic size and style of all four edges.
Values: see ...
Get CSS: The Missing Manual now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.