/

HTML / CSS / JavaScript Tutorial

CSS Property: border-image-repeat

[this page | pdf | back links]

The CSS (CSS3) border-image-repeat property specifies whether and how the border image should be repeated, rounded or stretched.

 

Valid property values (other than inherit and initial) are:

 

Value

Description

repeat

Image tiled (i.e. repeated) to fill area

round

Image tiled (i.e. repeated) to fill area (with image rescaled so that it exactly fits the area)

space

Image tiled (i.e. repeated) to fill area (with extra space distributed around tiles if the fit is not exact

stretch

(default value). Image stretch to fill area

 

Default Value:

stretch

JavaScript syntax:

e.g. object.style.borderImageRepeat="space"

Inherited:

No

Animatable:

No

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
p {
  border: 10px solid transparent;
  border-image: url('NematrianLogo.png') 20% 1 2 repeat;
  padding: 15px;
}
.x2 {border-image-repeat: space;}
</style>
</head>
<body>
<p>1. border-image: url('NematrianLogo.png') 20% 1 2 repeat;</p>
<p class="x2">2. different border-image-repeat property (space)</p>
<p id="x3">3. as per Element 2 but set using JavaScript</p>

<script>
document.getElementById("x3").style.borderImageRepeat = "space";
</script>

</body>
</html>

FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyBorderImageRepeat() {
  var x = document.createElement("DIV"); x.style.borderImageRepeat = "space"; return (window.getComputedStyle(x, null).borderImageRepeat == "space");
}


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile