Style borderLeft 属性

定义和用法
borderLeft 属性以速记形式设置或返回三个独立的左边框属性。
通过该属性,您可以设置/返回:
- border-left-width
- border-left-style
- border-left-color
语法
设置 borderLeft 属性:
Object.style.borderLeft = "width style color"
返回 borderLeft 属性:
Object.style.borderLeft
提示:borderLeft 属性没有默认值。
参数 | 描述 |
---|---|
width | 设置左边框的宽度。 |
style | 设置左边框的样式。 |
color | 设置左边框的颜色。 |
浏览器支持
所有主要浏览器都支持 borderLeft 属性。
实例
更改左边框的宽度、样式和颜色:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>蜜蜂教程(mifengjc.com)</title> <style type="text/css"> #ex1 { border: thin dotted #FF0000; } </style> <script> function displayResult() { document.getElementById("ex1").style.borderLeft = "thick solid #0000FF"; } </script> </head> <body> <div id="ex1">这是一些文本。</div> <br> <button type="button" onclick="displayResult()">修改左边框</button> </body> </html>
