XML technologies / CSS / Advanced websites with CSS / CSS property reference / border-style

(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)

The shorthand property border-style describes the border style for each side of an HTML element.

The properties border-bottom-style, border-left-style, border-right-style and border-top-style also allow each side’s border style to be specified separately.

Inherited: no

Values

The CSS specification provides a range of constants for defining border styles. The table lists all available constants and their browser compatibility.

Up to four space-separated values (one per side) can be specified for border-style. Netscape 4 supports only the same border style for all four sides of an element.

The values none and hidden produce different results only in HTML tables whose property border-collapse is set to collapse: if a cell’s border is set to none, the cell takes the border style of the other collapsed cells. The declaration border-style has no effect. If a border is set to hidden, it overrides the border style of the other collapsed cells and no border is displayed for the entire group of collapsed cells.

Default value: none

 

Table: CSS constants for different border styles.

Constant

CSS specification

Supported browsers

Border style

double

CSS1

all CSS-capable browsers

Border style double

groove

CSS1

all CSS-capable browsers

Border style groove

inset

CSS1

all CSS-capable browsers

Border style inset

none

CSS1

all CSS-capable browsers

Border style none

outset

CSS1

all CSS-capable browsers

Border style outset

ridge

CSS1

all CSS-capable browsers

Border style ridge

solid

CSS1

all CSS-capable browsers

Border style solid

dashed

CSS1

Netscape 6, Mozilla, IE 5.5/Win, IE 4/Mac

Border style dashed

dotted

CSS1

Netscape 6, Mozilla, IE 5.5/Win, IE 4/Mac

Border style dotted

hidden

CSS2

Netscape 6, Mozilla, IE 5.5/Win, IE 4/Mac

Border style hidden

Compatibility

CSS version: 1

Works in all CSS-capable browsers, including Internet Explorer 4 and Netscape 4. For more detailed compatibility information, see the table Values for border-color.

Note the default value 0 for border-width in Netscape 4.x: for a border to be visible at all in this browser, a width value must be declared.

Example

The following style rule gives all HTML elements of class klickbutton the appearance of a button, with border style outset, a light gray background and black text:

.klickbutton {
  border-style: outset;
  border-color: grey;
  border-width: medium;
  background: lightgrey; 
  color: black;
}

  

 

 

 

back to top