Learn CSS #14

CSS Border – Shorthand Property

Like you saw in the previous page, there are many properties to consider when dealing with borders.

To shorten the code, it is also possible to specify all the individual border properties in one property.

The border property is a shorthand property for the following individual border properties:

  • border-width
  • border-style (required)
  • border-color

Example

{
  border: 5px solid red;
}

Result:

Some text

You can also specify all the individual border properties for just one side:

Left Border

{
  border-left: 6px solid red;
}

Result:

Some text

Bottom Border

{
  border-bottom: 6px solid red;
}

Result:

Some text

33 thoughts on “Learn CSS #14

Leave a Reply

Your email address will not be published. Required fields are marked *