หากต้องการตั้งค่าคุณสมบัติ border left ทั้งหมดในการประกาศครั้งเดียว ให้ใช้ borderLeft คุณสมบัติ. คุณสามารถลองเรียกใช้รหัสต่อไปนี้เพื่อเรียนรู้วิธีตั้งค่าคุณสมบัติเส้นขอบด้านซ้าย -
ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<style>
#box {
border: thick solid gray;
width: 300px;
height: 200px
}
</style>
</head>
<body>
<div id = "box">Demo Text</div>
<br>
<br>
<button type = "button" onclick = "display()">Change left border</button>
<script>
function display() {
document.getElementById("box").style.borderLeft = "thick solid #000000";
}
</script>
</body>
</html>