Open In App

HTML DOM Style borderImage Property

The DOM Style borderImage Property in HTML is a shorthand property used for setting the borderImageSource, borderImageSlice, borderImageWidth,borderImageOutset, and borderImageRepeat properties.

Syntax: 



object.style.borderImage
object.style.borderImage = "source slice width outset repeat|
initial|inherit"

Property Values: In the borderImage property there is 7 property value which is mentioned above described below: 

Return Values: It returns a string value that represents the border-image property of an element.



Example 1: This show how to change the border-image. 




<!DOCTYPE html>
<html>
   
<head>
    <style>
        #my {
            border: 50px solid transparent;
            width: 250px;
            padding: 15px 15px;
 
            -webkit-border-image:
            100 100 stretch;
 
           -o-border-image:
            100 100 stretch;
 
            border-image:
            100 100 stretch;
        }
    </style>
</head>
 
<body>
    <h3>
          Click the "Change" button to change the
          border-image property
      </h3>
    <button onclick="myFunction()">Change</button>
    <div id="my">
        <h1>
            <font color="green">GeeksForGeeks</font>
        </h1>
    </div>
   
    <script>
        function myFunction() {
          // Code for Safari 5
            document.getElementById("my").style.WebkitBorderImage =
         
            // < !--Code for Opera 12 -- >
                document.getElementById("my").style.OBorderImage =
 
            document.getElementById("my").style.borderImage =
        }
    </script>
</body>
   
</html>

Output:

 

Example 2: Style borderImageSource Property.  




<!DOCTYPE html>
<html>
   
<head>
    <style>
        div {
            border: 30px solid transparent;
            border-image:
            border-image-slice: 30;
            border-image-width: 1 1 1 1;
            border-image-outset: 0;
            border-image-repeat: round;
        }
    </style>
</head>
<body>
    <h3>Here are the two images used:</h3>
    <img src=
         height="100" width="100">
    <img src=
         height="100" width="100">
   
    <div id="main">
        <h1><center><font color="green" >
          GeeksForGeeks
         </font></center></h1>
    </div>
    <h3>
          Click the "Change" button to change
        the value of the borderImageSource property.
      </h3>
    <button onclick="myFunction()">Change</button>
   
    <script>
        function myFunction() {
            document.getElementById("main").style.borderImageSource =
        }
    </script>
</body>
   
</html>

Output: 

 

Supported Browsers: The browser supported by DOM Style borderImage Property are listed below: 


Article Tags :