向 <div> 元素添加左边框:
document.getElementById("myDiv").style.borderLeft = "thick solid #0000FF";
亲自试一试 »
borderLeft 属性以简写形式设置或返回最多三个单独的 border-left 属性。
使用此属性,您可以设置/返回以下一项或多项(按任意顺序):
Property | |||||
---|---|---|---|---|---|
borderLeft | Yes | Yes | Yes | Yes | Yes |
返回 borderLeft 属性:
object.style.borderLeft
设置 borderLeft 属性:
object.style.borderLeft
= "width style color|initial|inherit"
Parameter | Description |
---|---|
width | Sets the width of the left border |
style | Sets the style of the left border |
color | Sets the color of the left border |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
默认值: | 未指定 |
---|---|
返回值: | 一个字符串,表示元素左边框的宽度、样式和/或颜色 |
CSS版本 | CSS1 |
更改 <div> 元素左边框的宽度、样式和颜色:
document.getElementById("myDiv").style.borderLeft = "thin dotted red";
亲自试一试 »
CSS教程:CSS 边框
CSS 参考:左边框属性
HTML DOM 参考:边境属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!