Skip to main content

CSS Borders

An element's border has a style, a width, and a color, and the CSS border properties control all three.


CSS Border Style

Which kind of border appears is decided by border-style.

It accepts these values:

  • dotted — a border made of dots.
  • dashed — a border made of dashes.
  • solid — a single solid line.
  • double — a double line.
  • groove — a 3D grooved look that varies with the border color.
  • ridge — a 3D ridged look that varies with the border color.
  • inset — a 3D inset look that varies with the border color.
  • outset — a 3D outset look that varies with the border color.
  • none — no border at all.
  • hidden — the border is hidden.

You can give border-style one to four values, covering the top, right, bottom, and left borders.

Note: Until border-style is set, the other border properties do nothing.

Example

Every paragraph below has its own border style.

Prompt
An HTML page that demonstrates all the CSS border-style values. In an internal <style> block, make paragraph classes for each style: dotted, dashed, solid, double, groove, ridge, inset, outset, none, hidden, and a mixed one (dotted dashed solid double). Add a paragraph for each so every border style is shown.
Output: complete HTML page