HTML DOM 样式 borderBottom 属性

htmlweb developmentfront end technology更新于 2024/5/20 12:28:17

borderBottom 属性用于设置或获取底部边框属性。border-bottom 属性是 border-bottom-width、border-bottom-style 和 border-bottom-color 的简写。

语法

以下是语法 −

设置 borderBottom 属性 −

object.style.borderBottom = "width style color|initial|inherit"

值

以下是上述属性值 −

Sr.No参数 &说明
1Width
用于设置底部边框宽度。
2Style
用于设置底部边框样式。
3Color
用于设置底部边框颜色。
4Initial
将此属性设置为初始值。
5Inherit
继承父级属性值。

示例

我们来看 borderBottom 属性的示例 −

<!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.borderBottom="10px dotted pink";
      document.getElementById("Sample").innerHTML="The bottom border for the image is now changed";
   }
</script>
</head>
<body>
<h2>Kotlin Tutorial</h2>
<img id="IMG1" src="https://www.cainiaomax.com/kotlin/images/kotlin.jpg">
<p>Change the above image below border by clicking the below button</p>
<button onclick="changeBorder()">Change Bottom Border</button>
<p id="Sample"></p>
</body>
</html>

输出

这将产生以下输出 −

点击"更改底部边框"按钮 −


相关文章


有用资源