The CSS reference

"border" - css property (v. css 1)

  • The 'border' property is a shorthand property for setting the same width, color and style on all four borders of an element.
  • To set values for each individual border you must look at the properties: 'border-top' , 'border-bottom' , 'border-left' and 'border-right'
  • Initial value: Not defined for shorthand properties
  • The property is not inherited
  • HTML usage: all elements
  • Browsers that support the border - property :
    Internet Explorer Mozilla Firefox Opera Google Chrome Apple Safari

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

Possible color values:

values Comments CSS
Color name HTML and CSS color specification defines 147 color names (17 standard colors plus 130 more). You find all the named color through the drop-down selection in the color picker below. 1
rgb(r,g,b) Integer values representing a color in the form of Red Green and Blue components each with a value between 0 - 255. (rgb(255,0,0) gives a red color) 1
#value A hexadecimal value representing a color in the form of Red Green and Blue components each with a value between 00 - FF. 1
inherit Will inherit the value from parent specification. This property value is new with CSS 2. 2
Color picker:

Selected Color:

Hex:
Red:
Green:
Blue:
Hue:
Saturation:
Value:
Harmonious colors:

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

Property "border" example:

<!DOCTYPE HTML >
<html  >
  <head>
    <title>Test</title>
    <style type="text/css">
      .presentation {
        border: #26B1B1 solid 10px ;
        width: 400px;
         }
     </style>
  </head>
  <body>
    <div class='presentation'  >The Inherit value is inherited from
          the parent specification. This property value is new
          with CSS 2.
    </div>
  </body>
</html>

Another property "border" example:

<!DOCTYPE HTML >
<html  >
  <head>
    <title>Test</title>
    <style type="text/css">
      .groove {border:  grey groove 12px;
        width: 400px;}
      .ridge {border:  green ridge 12px;
        width: 400px;}
      .inset {border:  blue inset 12px;
        width: 400px;}
      .outset {border:  black outset 12px;
        width: 400px;}
     </style>
  </head>
  <body>
    border-style "groove":<br>
    <div class='groove'  >A 3D groove is drawn in colors
      based on the color value.
    </div>
    border-style "ridge":<br>
    <div class='ridge'  >A 3D ridge is drawn in colors
      based on the color value.
    </div>
    border-style "inset":<br>
    <div class='inset'  >A 3D inset is drawn in colors
      based on the color value.
    </div>
    border-style "outset":<br>
    <div class='outset'  >A 3D outset is drawn in colors
      based on the color value.
    </div>
  </body>
</html>

Javascript access:

// To SET values ([o] is the target object)
[o].style.border="border 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.