HTML DOM Style borderImageWidth Property


The HTML DOM borderImageWidth property is used to set or get the width of the border image for an element.

Following is the syntax for −

Setting the borderImageWidth property −

object.style.borderImageWidth = "number|%|auto|initial|inherit"

The above properties are explained as follows −

ValueDescription
lengthFor describing the border width size in px.
numberFor describing the border width in multiples of corresponding border width and it’s default value is 1.
%For describing the horizontal offsets and vertical off sets for the border image area width.
autoThis sets the width and height corresponding to the image width and height.
initialFor setting this property to default value.
inheritTo inherit the parent property value.

Let us look at an example for the borderImageWidth property −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
   #DIV1 {
      width: 400px;
      padding: 25px;
      border-style: solid;
      border-color: transparent;
      border-image-slice: 30;
      border-image-source: url("https://www.tutorialspoint.com/ethereum/images/ethereum-mini-            logo.jpg");
      border-image-width: 10px;
}
</style>
<script>
   function changeBorderWidth(){
      document.getElementById("DIV1").style.borderImageWidth="30px";
      document.getElementById("Sample").innerHTML="The border image width is now increased";
}
</script>
</head>
<body>
<div id="DIV1">HELLO</div>
<p>Increase the above div border image width by clicking the below button</p>
<button onclick="changeBorderWidth()">Change Border Width</button>
<p id="Sample"></p>
</body>
</html>

Output

On clicking the “Change Border Width” button −

Updated on: 22-Oct-2019

36 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements