The side-specific and the shorthand border properties may
include a border-style value, a
border-width value, and a border-color value. They do not need to be
in any particular order. You do not need to declare all three border
qualities, but keep in mind that if the border-style is not declared, there will be
no border.
The border shorthand is
somewhat different from the other shorthand properties discussed so
far in that it can be used to apply border properties to all four
sides of the element only. It does not provide a way to target certain
borders and there is no system of value replication.
The rules listed here are all valid examples of the border shortcut properties.
h1 {border-left: .5em solid blue; }
h1 {border-left: solid blue .5em; }
h1 {border-left: solid .5em; }
p.example {border: 2px dotted #666633; }
p.example {border: dotted 2px; }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