CSS Reference Property

border-right-width 5i681u

The border-right-width property is used to set the width of the right border of an element. 233l52

The width of the border can be explicitly set using a <length> value, or by using one of three border width keywords: thin, medium, and thick.

Official Syntax 4j1l4a

  • Syntax:

    border-right-width: <length> | thin | medium | thick
  • Initial: medium
  • Applies To: all elements
  • Animatable: yes

Notes 5i3os

Note that the initial width is medium, but the initial border style of an element is none and therefore the used width is 0.

Values 4w6m73

<length>
The width of the border is set to the specified length. Negative values are not allowed.
thin
Implementation-specfic. See note below and the live demo for examples.
medium
Implementation-specfic. See note below and the live demo for examples.
thick
Implementation-specfic. See note below and the live demo for examples.

Notes 5i3os

The specification doesn’t precisely define the thickness of each of the keywords, which is therefore implementation specific, but the values are constant throughout a document and thin ? medium ? thick. A browser could, for example, make the thickness depend on the medium font size: one choice might be 1px (for thin), 3px (for medium) & 5px (for thick) when the medium font size is 17px or less.

The border-right-width property can also inherit the value of the element’s parent’s right border width using the keyword inherit.

Examples 3y6d6i

The following are all valid border-right-width values set on an element. The element’s border style and border color are also set using the border-right-color respectively.

.element {
    border-right-style: dotted;
    border-right-color: red;

    border-right-width: 10px;
    /* or */
    border-right-width: thin;
    /* or */
    border-right-width: 1em;
}
                

Live Demo 176n59

Have a look at the live demo:

View this demo on the Codrops Playground

Browser s162l

The property works in all major browsers: Chrome, Firefox, Safari, Opera, IE, and on Android and iOS.

Written by

Last updated June 3, 2020 at 12:35 pm by Mary Lou

Do you have a suggestion, question or want to contribute? Submit an issue.