The CSS reference
"border-width" - css property (v. css 1)
- Sets the width of the four borders
- This property is a shorthand property for setting 'border-top-width' , 'border-right-width' , 'border-bottom-width' and 'border-left-width' 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-width - property :
Possible width values:
Values | Comments | CSS |
---|---|---|
thin, medium or thick | The width of the keyword values are UA dependent, but the following holds: 'thin' <= 'medium' <= 'thick'. | 1 |
length | With this you specify a value with a unit identifier. | 1 |
inherit | Will inherit the value from parent specification. This property value is new with CSS 2. | 2 |
Possible unit identifier:
unit identifier | Comments | CSS |
---|---|---|
em | The relative unit 'em' is relative to the font size of the element itself. | 1 |
ex | The relative unit 'ex' is relative to the font size of the element itself. | 1 |
px | Pixels, relative to the viewing device | 1 |
in | inches -> 1 inch is equal to 2.54 centimeters. | 1 |
cm | centimeters. | 1 |
mm | millimeters. | 1 |
pt | points -> the points used by CSS2 are equal to 1/72th of an inch. | 1 |
pc | picas -> 1 pica is equal to 12 points. | 1 |
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 widths will be set to this value. |
value1 value2 | When you specify two values, then the top and the bottom border width is set to value1 and left and right border width will be set to value2. |
value1 value2 value3 | When you specify three values, then the top border width will be set to value1, left and right border width will be set to value2 and the bottom border width will be set to value3. |
value1 value2 value3 value4 | When you specify four values, then the top border width will be set to value1, the right border width will be set to value2, the bottom border width will be set to value3 and the left border width will be set to value4. |
Property "border-width" 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>
© 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.