The CSS reference
"border-style" - css property (v. css 1)
- Sets the style of the four borders
- This property is a shorthand property for setting 'border-top-style' , 'border-right-style' , 'border-bottom-style' and 'border-left-style' at the same place in the style sheet.
- Initial value: see individual properties
- The property is not inherited
- HTML usage: all elements
-
Browsers that support the border-style - property :
Possible border styles values:
border style | Comments | CSS |
---|---|---|
none | No border is drawn (regardless of the 'border-width' value). | 1 |
dotted | The border is a dotted line drawn on top of the background of the element. | 1 |
dashed | The border is a dashed line drawn on top of the background of the element. | 1 |
solid | The border is a solid line. | 1 |
double | The border is a double line drawn on top of the background of the element. The sum of the two single lines and the space between equals the 'border-width' value. | 1 |
groove | A 3D groove is drawn in colors based on the <color> value. | 1 |
ridge | A 3D ridge is drawn in colors based on the <color> value. | 1 |
inset | A 3D inset is drawn in colors based on the <color> value. | 1 |
outset | A 3D outset is drawn in colors based on the <color> value. | 1 |
inherit | Will inherit the value from parent specification. This property value is new with CSS 2. | 2 |
You can set one to four values:
Amount of values | Result of setting values |
---|---|
value | When you specify only one value, then all the border styles will be set to this value. |
value1 value2 | When you specify two values, then the top and the bottom border style is set to value1 and left and right border style will be set to value2. |
value1 value2 value3 | When you specify three values, then the top border style will be set to value1, left and right border style will be set to value2 and the bottom border style will be set to value3. |
value1 value2 value3 value4 | When you specify four values, then the top border style will be set to value1, the right border style will be set to value2, the bottom border style will be set to value3 and the left border style will be set to value4. |
Property "border-style" example:
<!DOCTYPE HTML >
<html >
<head>
<title>Test</title>
<style type="text/css">
.presentation {
border-color: #aad5ff;
border-style: solid; }
table.presentation {
border-width: 0 0 1px 1px;
width: 500px; }
th.presentation, td.presentation {
border-width: 1px 1px 0 0;
padding: 4px 4px 4px 4px; }
th.presentation { background-color: #D4FFAA;}
</style>
</head>
<body>
<table class='presentation' border='0'
cellpadding='0' cellspacing='0' >
<tr>
<th class='presentation' style="width: 22%">Values</th>
<th class='presentation'>Comments</th>
<th class='presentation'>CSS</th>
</tr>
<tr>
<td class='presentation'>thin, medium or thick</td>
<td class='presentation'>The width of the keyword
values are UA dependent,
but the following holds: <b>'thin' <= 'medium'
<= 'thick'</b>. </td>
<td class='presentation'>1</td>
</tr>
<tr>
<td class='presentation'>length</td>
<td class='presentation'>With this you specify a
value with a <b>unit identifier</b>. </td>
<td class='presentation'>1</td>
</tr>
<tr>
<td class='presentation'>inherit</td>
<td class='presentation'>Will inherit the value from
parent specification. This property value is new
with CSS 2.</td>
<td class='presentation'>2</td>
</tr>
</table>
</body>
</html>
Javascript access:
// To SET values ([o] is the target object)
[o].style.borderStyle="border-style values"
// Browsers can not return any trustworthy value from this property.
// To GET values, look at the details for each edge of the border.
© 2010 by Finnesand Data.
All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the
correctness in the pages or source codes.
The risk of using this web-site pages or any program
codes from this website is entirely at the individual user.