This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.

Smartphone icons created by Freepik - Flaticon

2.3.3 Border Sides

From the examples on the previous pages, you have seen that it is possible to specify a different border for each side. In CSS, there are also properties for specifying each of the borders (top, right, bottom, and left):

Example 1: Individual Border Sides part 1
p {
  border-top-style: dotted;
  border-right-style: solid;
  border-bottom-style: dotted;
  border-left-style: solid;
}
Results

Different Border Styles.

The example above gives the same result as this:

Example 2: Individual Border Sides part 2
p {
  border-style: dotted solid;
}

Here is how it works:

If the border-style property has four values:

If the border-style property has three values:

If the border-style property has two values:

If the border-style property has one value:

Example 3: Individual Border Sides part 3
/* Four values */
p {
  border-style: dotted solid double dashed;
}

/* Three values */
p {
  border-style: dotted solid double;
}

/* Two values */
p {
  border-style: dotted solid;
}

/* One value */
p {
  border-style: dotted;
}

The border-style property is used in the example above. However, it also works with border-width and border-color.