English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules (RULES)

Complete List of CSS Properties

CSS border-left Attribute Usage and Example

border-left CSS attribute sets the width, style, and color of the element's left border. It is used to set various left border attributes (i.e.border-left-width,border-left-styleandborder-left-colorof ( ) Abbreviated Attribute.

The table below provides usage instructions and version history of this attribute, as well as the syntax of using this attribute in JavaScript scripts.

Default Value:View All Attributes
Applicable To:All Elements
Inheritance:None
Animatable:Yes,Please Refer to Individual Attribute.Please Refer to Animation Attributes.
Version:CSS 1,2,3
JavaScript Syntax:    
object.style.borderLeft="2px solid red"

left Border Usage Syntax

The syntax of this attribute is as follows:

border-left: [ border-left-width border-left-style border-left-color ] | initial | inherit

The following example demonstrates how to use border-left Attribute.

  h1 {
   border-left: 5px solid #ff0000;
  }
  p {
   border-left: 3px dotted #00ff00;
  }
Test and See‹/›

Attribute Value

The table below describes the value of this attribute.

ValueDescription
border-left-widthSet the width of the element's left border.
border-left-styleSet the line style of the element's left border.
border-left-colorSet the color of the element's left border.
initialSet this attribute to its default value.
inheritIf specified, the associated element adopts its parent element's border-left Attribute Value.

Browser Compatibility

border-Browser Compatibility of left Attribute, the numbers in the table below represent the minimum version number of the browser that supports this attribute; all mainstream browsers support this attribute.

  • Firefox 1+

  • Google Chrome1+

  • Internet Explorer 4+

  • Apple Safari 1+

  • Opera 4+

Further Reading

See Tutorial:CSS Border,CSS3 Border.

Related Attributes:border,border-left-color,border-left-style,border-left-width.