ในการตั้งค่าความกว้างของเส้นขอบรูปภาพ ให้ใช้ borderImageWidth คุณสมบัติใน JavaScript
ตัวอย่าง
คุณสามารถลองใช้โค้ดต่อไปนี้เพื่อเรียนรู้วิธีกำหนดความกว้างของเส้นขอบเป็นรูปภาพ -
<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color:gray;
border: 40px solid;
border-image: url('https://www.tutorialspoint.com/images/neo4j.png');
border-image-slice: 50;
border-image-width: 20px;
border-image-width: 1 1 1 1;
border-image-outset: 0;
border-image-repeat: round;
}
</style>
</head>
<body>
<div id="box">
<p>Demo Text!</p>
</div>
<button onclick="display()">Set Width</button>
<script>
function display(){
document.getElementById("box").style.borderImageWidth = "20px 30px";
}
</script>
</body>
</html>