css property
`border-right-width` CSS property
The border-right-width CSS property sets the width of the right border of an element.
Interactive exampleOpen the canonical MDN source to run this embedded demo.
border-right-width: thick;
border-right-width: 2em;
border-right-width: 4px;
border-right-width: 2ex;
border-right-width: 0;
<section class="default-example" id="default-example">
<div class="transition-all" id="example-element">
This is a box with a border around it.
</div>
</section>
#example-element {
background-color: palegreen;
color: black;
border: 0 solid crimson;
padding: 0.75em;
width: 80%;
height: 100px;
}
Syntax
/* Keyword values */
border-right-width: thin;
border-right-width: medium;
border-right-width: thick;
/* <length> values */
border-right-width: 10em;
border-right-width: 3vmax;
border-right-width: 6px;
/* Global keywords */
border-right-width: inherit;
border-right-width: initial;
border-right-width: revert;
border-right-width: revert-layer;
border-right-width: unset;
Values
<line-width>- : Defines the width of the border, either as an explicit non-negative
<length>or the keywords:thin,medium, orthick. The default ismedium.
- : Defines the width of the border, either as an explicit non-negative
Formal definition
Formal syntax
Examples
Comparing border widths
HTML
<div>Element 1</div>
<div>Element 2</div>
CSS
div {
border: 1px solid red;
margin: 1em 0;
}
div:nth-child(1) {
border-right-width: thick;
}
div:nth-child(2) {
border-right-width: 2em;
}
Result
Interactive exampleOpen the canonical MDN source to run this embedded demo.
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
- The other border-width-related CSS properties:
border-bottom-width,border-left-width,border-top-width, andborder-width. - The other border-right-related CSS properties:
border,border-right,border-right-style, andborder-right-color.