ในการตั้งค่าคุณสมบัติ borderBottom ในการประกาศครั้งเดียวใน JavaScript ให้ใช้คุณสมบัติ borderBottom ช่วยให้คุณสามารถตั้งค่า border-bottom-width, border-bottom-style และ border-bottom-color
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อเรียนรู้วิธีตั้งค่าคุณสมบัติขอบด้านล่าง -
<!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.borderBottom = "thin dashed #000000";
}
</script>
</body>
</html>