如何在JavaScript DOM中设置底部边框的颜色?
要在JavaScript中设置底部边框的颜色,请使用borderBottomColor属性。它允许您设置边框底部的边框颜色。
示例
您可以尝试运行以下代码以了解如何设置底部边框的颜色-
<!DOCTYPE html>
<html>
<head>
<style>
#box {
border: 2px dashed blue;
width: 120px;
height: 120px;
}
</style>
</head>
<body>
<button onclick="display()">Set border bottom color</button>
<div id="box">
<p>Demo Text</p>
<p>Demo Text</p>
</div>
<script>
function display() {
document.getElementById("box").style.borderBottomColor = "yellow";
}
</script>
</body>
</html>