CSS: Setting All Border Attributes At Once

This entry is part 24 of 26 in the series Basic CSS

A similar shortcut lets you specify border attributes for all four sides at once.

We can use the border attribute.

<!DOCTYPE html>
<head lang='en'>     
    <meta charset='UTF-8'>
        h3 {
            border: 2px green solid;

        p {
            border-style: solid;
            border-top-color: blue;
            border-bottom-color: red;
            border-width: 2px;

<h3>Cape Town</h3>


Series Navigation<< CSS: Formatting border sides individually
CSS: Alignment of a paragraph >>
Posted in