border-left
Sets left border properties at once. The properties you can specify together are『border-color』,『border-style』, and『border-width』. The order of values does not matter.
Sample Code
div.test { border-left: dashed;}
div.test1 { border-left: dashed 2px;}
div.test2 { border-left: solid 2px #000;}
Available Values (border-color)
| Value | Description |
|---|---|
| transparent | Sets the border to transparent. |
| Color code or color name | Changes the border to the specified color. If no『border-color』value is set, the color of the『color』property is used as the default. |
Available Values (border-style)
| Value | Description |
|---|---|
| none | No border is drawn. The width is also set to 0. This is the default value. |
| solid | Draws a single solid line. |
| dashed | Draws a dashed border with larger gaps. |
| dotted | Draws a dotted border with smaller gaps. |
| double | Draws a double line border. |
| groove | Draws a border that looks carved in. The opposite of『ridge』. |
| ridge | Draws a border that looks raised. The opposite of『groove』. |
| inset | Draws a border that looks embedded. The opposite of『outset』. |
| outset | Draws a border that looks raised outward. The opposite of『inset』. |
Available Values (border-width)
| Value | Description |
|---|---|
| Number | Specifies the border width using units such as『px』. |
| thin | Specifies using the keyword『thin』. Most browsers display this as 1px, though it may vary slightly. |
| medium | Specifies using the keyword『medium』. Most browsers display this as 3px, though it may vary slightly. This is the default when no『border-width』value is specified. |
| thick | Specifies using the keyword『thick』. Most browsers display this as 5px, though it may vary slightly. |
Browser Preview
<div style="border-left: none; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>
<div style="border-left: solid 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>
<div style="border-left: dashed 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>
<div style="border-left: dotted 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>
<div style="border-left: double 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>
<div style="border-left: groove 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>
<div style="border-left: ridge 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>
<div style="border-left: inset 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>
<div style="border-left: outset 10px #cccccc; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>
Browser Compatibility
8 ○
7 ○
6 ○
2 and below ×
Android Browser
4.4+ ○
3 and below ×※ Version information is based on MDN.
Notes
You can set the border-related properties『border-color』,『border-style』, and『border-width』at once. The order of values does not matter.
When you write the『border-left』property, any left border values not specified will be reset to their initial values. This means all previously set left border properties are overridden.
<div style="border-width: 10px; border-style: dashed; border-left: solid; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>
To display any left border, you must specify the『border-style』property. Since the default value of『border-style』is『none』(width 0), no border will be drawn unless a value is specified.
If you find any errors or copyright issues, please contact us.