CSS PROPERTIES
Expand All | Collapse All
CSS AT-RULES
Advertisements

CSS border-style Property

Topic: CSS3 Properties ReferencePrev|Next

Description

The border-style CSS property is a shorthand property for setting the individual border style properties i.e. border-top-style, border-right-style, border-bottom-style, and border-left-style in a single declaration.

The following table summarizes the usages context and the version history of this property.

Default value: none
Applies to: All elements
Inherited: No
Animatable: No. See animatable properties.
Version: CSS 1, 2, 3

Syntax

The syntax of the property is given with:

border-style: 
[ none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset ] 1 to 4 values | initial | inherit

This shorthand notation can take one, two, three, or four whitespace separated values.

  • If one value is specified, it applies to all four border sides.
  • If two values are specified, the first value applies to the top and bottom border, while the second value applies to the right and left sides border.
  • If three values are specified, the first value applies to the top border, the second value applies to the right and left border, and the third value applies to the bottom border.
  • If four values are specified, each value applies to the border individually in the order top, right, bottom, and left.

The example below shows the border-style property in action.

p {
    border-style: double;
    border-width: 5px;
}

Property Values

The following table describes the values of this property.

Value Description
none No border will be displayed.
hidden Same as none, except the case where table cells have collapsed borders and the two cells share a border. The hidden value ensures that no border is drawn, since hidden take precedence over all other border styles.
dotted Displays the border as a series of dots.
dashed Displays the border as a series of short line segments i.e. dashes.
solid Displays the border as a single solid line.
double Displays the border as a two parallel solid lines with some space between them. The sum of the two lines and the space between them equals the value of border-width.
groove Displays the border as it were carved into the canvas. It gives the impression of 3D that is typically achieved by creating a shadow from two colors that are slightly lighter and darker than the border-color.
ridge Displays the border that has the opposite effect of groove: It also gives the impression of 3D, the border looks as though it were coming out of the canvas.
inset Displays the border that makes the element's box look as though it were embedded in the canvas. It gives the impression of 3D that is typically achieved by creating a shadow from two colors that are slightly lighter and darker than the border-color.
outset Displays the border that has the opposite effect of inset: It also gives the impression of 3D, the border makes the box look as though it were coming out of the canvas.
inherit If specified, the associated element takes the computed value of its parent element border-top-style property.

Browser Compatibility

The border-style property is supported in all major modern browsers.

Browsers Icon

Browser Support–

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 4+
  • Apple Safari 1+
  • Opera 4+

Further Reading

See tutorial on: CSS Border, CSS3 Border.

Related properties: border, border-width, border-color, border-top-style, border-right-style, border-bottom-style, border-left-style.

Advertisements
Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties