Related Articles

Related Articles

HTML | DOM Style borderImageRepeat Property
  • Last Updated : 21 Dec, 2020

The borderImageRepeat property in HTML DOM is used to set or return the borderImageRepeat property. It specifies whether the border-image should repeat to fill the area, stretched to fill the area, set to the initial value, inherit property from its parent, etc. Depending on the need it will set accordingly to make the image border look more attractive. 

Syntax: 

  • It returns the borderImageRepeat property. 
object.style.borderImageRepeat
  • It sets the borderImageRepeat property. 
object.style.borderImageRepeat="stretch|repeat|round|
initial | inherit"

Return value: It returns the border-image repeat property.

Property Values: 

  • stretch: This property is used to stretch the image to fill the area. It is the default value.

Syntax: 



object.style.borderImageRepeat="stretch";
  • Example: 

html

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
     
<head>
    <style>
        #GFG {
            border: 20px solid transparent;
            width: 200px;
            padding: 10px 20px;
             
            /* For Safari Browser */
            -webkit-border-image: url(
            50 50 round;
             
            /* For Opera Browser */
            -o-border-image: url(
            50 50 round;
             
            border-image: url(
            50 50 round;
        }
    </style>
</head>
 
<body>
     
    <div id = "GFG">
        <h1>GeeksforGeeks</h1>
    </div><br>
     
    <button onclick = "myGeeks()">
        Click Here!
    </button>
     
     
<p>
        Click on button to change property
    </p>
 
     
    <script>
        function myGeeks() {
             
            /* For Safari Browser */
            document.getElementById("GFG").style.WebkitBorderImage =
            50 50 stretch";
             
            /* For Opera Browser */
            document.getElementById("GFG").style.OBorderImage =
            50 50 stretch";
             
            document.getElementById("GFG").style.borderImage =
            50 50 stretch";
        }
    </script>
 
</body>
</html>                   

chevron_right


  • Output: 
    Before click on the button: 
     

  • After clicking on the button: 
     

  • repeat: This property is used to repeat the border-image to fill the area.
    Syntax: 
object.style.borderImageRepeat =  "repeat";
  • Example: 

html

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
     
<head>
    <style>
        #GFG {
            border: 15px solid transparent;
            width: 200px;
            padding: 10px 20px;
             
            /* For Safari Browser */
            -webkit-border-image: url(
            50 50 stretch;
             
            /* For Opera Browser */
            -o-border-image: url(
            50 50 stretch;
             
            border-image: url(
            50 50 stretch;
        }
    </style>
</head>
 
<body>
     
    <div id = "GFG">
        <h1>GeeksforGeeks</h1>
    </div><br>
     
    <button onclick="myGeeks()">
        Click Here!
    </button>
     
     
<p>
        Click on button to change property
    </p>
 
     
    <script>
        function myGeeks() {
             
            /* For Safari Browser */
            document.getElementById("GFG").style.WebkitBorderImage =
            50 50 repeat";
             
            /* For Opera Browser */
            document.getElementById("GFG").style.OBorderImage =
            50 50 repeat";
             
            document.getElementById("GFG").style.borderImage =
            50 50 repeat";
        }
    </script>
</body>
 
</html>                   

chevron_right


  • Output: 
    Before click on the button: 
     

  • After clicking on the button: 
     

  • round: It is used to repeat the image to fill the area. If the image doesn’t fill the area in a whole number of tiles the image is rescaled.

Syntax: 

object.style.borderImageRepeat = "round";
  • Example: 
     

html

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
     
<head>
    <style>
        #GFG {
            border: 15px solid transparent;
            width: 200px;
            padding: 10px 20px;
             
            /* For Safari Browser */
            -webkit-border-image: url(
            50 50 stretch;
             
            /* For Opera Browser */
            -o-border-image: url(
            50 50 stretch;
             
            border-image: url(
            50 50 stretch;
        }
    </style>
</head>
 
<body>
     
    <div id = "GFG">
        <h1>GeeksforGeeks</h1>
    </div><br>
     
    <button onclick="myGeeks()">
        Click Here!
    </button>
     
     
<p>
        Click on button to change property
    </p>
 
     
    <script>
        function myGeeks() {
             
            /* For Safari Browser */
            document.getElementById("GFG").style.WebkitBorderImage =
            50 50 round";
             
            /* For Opera Browser */
            document.getElementById("GFG").style.OBorderImage =
            50 50 round";
             
            document.getElementById("GFG").style.borderImage =
            50 50 round";
        }
    </script>
</body>
 
</html>                   

chevron_right


  • Output: 
    Before clicking on the button: 
     

  • After clicking on the button: 
     

  • space: The only difference with the repeat value is that if it does not fill the area with a whole number of tiles, then extra space is distributed around the tiles. 
    Syntax: 
object.style.borderImageRepeat = "space";
  • Example: 

html

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
<head>
    <style>
        #GFG {
            border: 15px solid transparent;
            width: 200px;
            padding: 10px 20px;
             
            /* For Safari Browser */
            -webkit-border-image: url(
            50 50 stretch;
             
            /* For Opera Browser */
            -o-border-image: url(
            50 50 stretch;
             
            border-image: url(
            50 50 stretch;
        }
    </style>
</head>
 
<body>
     
    <div id="GFG">
        <h1>GeeksforGeeks</h1>
    </div><br>
     
    <button onclick="myGeeks()">
        Click Here!
    </button>
     
     
<p>
        Click on button to change property
    </p>
 
     
    <script>
        function myGeeks() {
             
            /* For Safari Browser */
            document.getElementById("GFG").style.WebkitBorderImage =
    50 50 space";
     
            /* For Opera Browser */
            document.getElementById("GFG").style.OBorderImage =
        50 50 space";
            document.getElementById("GFG").style.borderImage =
        50 50 space";
        }
    </script>
</body>
 
</html>                   

chevron_right


  • Output: 
    Before clicking on the button: 
     

  • After clicking on the button: 
     

  • initial: It is used to set borderImageRepeat property to its default value.
  • inherit: It is used to set borderImageRepeat property from its parent element.

Browser Support: The browser supported by DOM style borderImageRepeat property are listed below: 

  • Google Chrome
  • Internet Explorer 11.0
  • Mozilla firefox
  • Safari 6.0

 

full-stack-img




My Personal Notes arrow_drop_up
Recommended Articles
Page :