Style borderRightWidth attribute

Definition and usage

borderRightWidth Sets or returns the width of the element's right border.

See also:

CSS Tutorial:CSS 边框

CSS Reference Manual:border-right-width attribute

HTML DOM Reference Manual:border attribute

Example

Example 1

Change the width of the right border of the <div> element to 10px:

document.getElementById("myDiv").style.borderRightWidth = "10px";

Try it yourself

Example 2

Change the width of the right border of the <div> element to thin:

document.getElementById("myDiv").style.borderRightWidth = "thin";

Try it yourself

Example 3

Returns the width of the right border of the <div> element:

alert(document.getElementById("myDiv").style.borderRightWidth);

Try it yourself

Syntax

Return borderRightWidth attribute:

object.style.borderRightWidth

Set borderRightWidth attribute:

object.style.borderRightWidth = "thin|medium|thick|length|initial|inherit"

Attribute value

Value Description
thin Define thin border.
medium Define medium border. Default.
thick Define thick border.
length Border width in length units.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: medium
Return value: A string that represents the width of the element's right border.
CSS version: CSS1

Browser supports

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
支持 支持 支持 支持 支持