Style borderLeft 属性

Style 对象参考手册 Style 对象

定义和用法

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设置左边框的颜色。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 borderLeft 属性。


实例

实例

更改左边框的宽度、样式和颜色:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本站教程(icodebang.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>

尝试一下 »


Style 对象参考手册 Style 对象

0 个评论

要回复文章请先登录注册