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 |
|---|---|---|---|
| CSS1 | all CSS-capable browsers | |
| CSS1 | all CSS-capable browsers | |
| CSS1 | all CSS-capable browsers | |
| CSS1 | all CSS-capable browsers | |
| CSS1 | all CSS-capable browsers | |
| CSS1 | all CSS-capable browsers | |
| CSS1 | all CSS-capable browsers | |
| CSS1 | Netscape 6, Mozilla, IE 5.5/Win, IE 4/Mac | |
| CSS1 | Netscape 6, Mozilla, IE 5.5/Win, IE 4/Mac | |
| CSS2 | Netscape 6, Mozilla, IE 5.5/Win, IE 4/Mac | |
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;
}
Copyright © 2006 of the German translation, dpunkt.verlag GmbH
You may print the online version for your private use.
Otherwise, this chapter from “CSS − Anspruchsvolle Websites mit Cascading Stylesheets” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19, 69115 Heidelberg
