HTML DOM 样式 borderBottomColor 属性

htmlweb developmentfront end technology更新于 2024/5/20 11:56:17

borderBottomColor 属性用于设置或获取元素的底部边框颜色。必须声明 border-style,因为元素必须具有边框才能使此属性生效。

语法

以下是设置 borderBottomColor 属性的语法 −

object.style.borderBottomColor = "color|transparent|initial|inherit"

以下是返回 borderBottomColor 属性的语法 −

object.style.borderBottomColor

值

属性值解释如下 −

Sr.No值和说明
1color
用于指定底部边框颜色。默认颜色为黑色。
2transparent
使底部边框透明,即可以从底部看到内容。
3Initial
将此属性设置为初始值。
4Inherit
继承父级属性值。

示例

让我们看一个 borderBottomColor 属性的示例 −

<!DOCTYPE html>
<html>
<head>
<style>
   #IMG1 {
      border-bottom: 7px solid orange;
      box-shadow: 2px 2px 4px 1px seagreen;
   }
</style>
<script>
   function changeBorder(){
      document.getElementById("IMG1").style.borderBottomColor="pink";
      document.getElementById("Sample").innerHTML="The bottom border color for the image is now changed";
   }
</script>
</head>
<body>
<h2>iOS Tutorial</h2>
<img id="IMG1" src="https://www.cainiaomax.com/ios/images/ios.jpg">  
<p>Change the above image's below border...</p>
<button onclick="changeBorder()">Change Bottom Border</button>
<p id="Sample"></p>
</body>
</html>

输出

这将产生以下输出 −

点击"更改底部边框" −


相关文章


有用资源