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

CSS Reference Manual

CSS @rules (RULES)

Comprehensive List of CSS Properties

CSS border-right attribute usage and example

    border-right css attribute sets the width, style, and color of the element's right border. It is used to set a single right border attribute (i.e., to setborder-right-width,border-right-styleandborder-right-colorThe shorthand attribute of )

The following table provides usage instructions and version history of this attribute, as well as its usage syntax in JavaScript scripts.

Default value:View all properties
Applicable to:All elements
Inheritance:None
Animaatable:Yes,Please refer to individual properties.Please refer to Animation properties.
Version:CSS 1,2,3
JavaScript syntax:    
object object.style.borderRight="3px solid red"

border-right usage syntax

The syntax of this attribute is as follows:

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

The following example demonstrates how to use border-right attribute.

  h1 {
   border-right: 5px dashed #ff0000;
  }
  p {
   border-right: 3px dotted #00ff00;
  }
Test and see‹/›

Attribute value

The following table describes the value of this attribute.

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

Browser compatibility

border-The compatibility of the right attribute in browsers, the numbers in the table below represent the minimum version number of the browsers that support 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 properties:border,border-right-color,border-right-style,border-right-width.