Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

CSS Dictionary

  1. Home
  2. CSS Dictionary
  3. border

border

Specifies border properties all at once. The properties you can set together are 'border-color', 'border-style', and 'border-width'. The order of values does not matter.

Sample Code

div.test { border: dashed;}
div.test1 { border: dashed 2px;}
div.test2 { border: solid 2px #000;}

Available Values (border-color)

ValueDescription
transparentSets the border color to transparent.
Color code or color nameChanges the border to the specified color. If no 'border-color' value is specified, the 'color' property value is used as the initial value.

Available Values (border-style)

ValueDescription
noneNo border is drawn. The width also becomes 0. This is the initial value.
solidDraws a single solid line border.
dashedDraws a dashed border with larger gaps.
dottedDraws a dotted border with smaller gaps.
doubleDraws a border with two lines.
grooveDraws a border that looks carved in. Opposite of 'ridge'.
ridgeDraws a border that looks raised. Opposite of 'groove'.
insetDraws a border that looks embedded. Opposite of 'outset'.
outsetDraws a border that looks raised outward. Opposite of 'inset'.

Available Values (border-width)

ValueDescription
NumberSpecifies the border width in units such as 'px'.
thinThe keyword 'thin'. Typically rendered as 1px, though it may vary slightly by browser.
mediumThe keyword 'medium'. Typically rendered as 3px, though it may vary slightly by browser. This is the initial value when no 'border-width' is specified.
thickThe keyword 'thick'. Typically rendered as 5px, though it may vary slightly by browser.

Browser Preview

<div style="border: none; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

<div style="border: solid 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

<div style="border: dashed 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

<div style="border: dotted 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

<div style="border: double 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

<div style="border: groove 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

<div style="border: ridge 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

<div style="border: inset 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

<div style="border: outset 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

Browser Support

Chrome Chrome
1+
Firefox Firefox
1+
Safari Safari
1+
Edge Edge
12+
Supported in all versions
IE IE
11
10
9
8
7
6
Opera Opera
3.5+
2 and earlier ×
iOS Safari iOS Safari
1+
Android Android Browser
4.4+
3 and earlier ×
Chrome Android Chrome Android
Latest
Same support as desktop
Firefox Android Firefox Android
Latest
Same support as desktop

※ Version data based on MDN.

Overview

Sets the 'border-color', 'border-style', and 'border-width' properties all at once. The order of values does not matter.

When 'border' is specified, any border properties not explicitly set are reset to their initial values. The 'border-image' property — which cannot be set via 'border' — is also reset to 'none'. In other words, all previously specified border properties are overridden.

<div style="border-width: 10px; border-style: dashed; border: solid; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>

To display a border, you must always specify a 'border-style' value. The initial value of 'border-style' is 'none' (width 0), so no border will be drawn unless a value is explicitly set.

The 'border' property cannot set each side independently. To set each side separately, use 'border-top', 'border-right', 'border-bottom', and 'border-left' respectively.

If you find any errors or copyright issues, please .