Add a right border to a <div> element:
document.getElementById("myDiv").style.borderRight = "thick solid #0000FF";
Try it Yourself »
The borderRight property sets or returns up to three separate border-right properties, in a shorthand form.
With this property, you can set/return one or more of the following (in any order):
Property | |||||
---|---|---|---|---|---|
borderRight | Yes | Yes | Yes | Yes | Yes |
Return the borderRight property:
object.style.borderRight
Set the borderRight property:
object.style.borderRight
= "width style color|initial|inherit"
Parameter | Description |
---|---|
width | Sets the width of the right border |
style | Sets the style of the right border |
color | Sets the color of the right border |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | not specified |
---|---|
Return Value: | A String, representing the width, style and/or color of the right border of an element |
CSS Version | CSS1 |
Change the width, style and color of the right border of a <div> element:
document.getElementById("myDiv").style.borderLeft = "thin dotted red";
Try it Yourself »
Return the border-right property values of a <div> element:
alert(document.getElementById("myDiv").style.borderLeft);
Try it Yourself »
CSS tutorial: CSS Border
CSS reference: border-right property
HTML DOM reference: border property
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!