/

HTML / CSS / JavaScript Tutorial

CSS Property: border-image-source

[this page | pdf | back links]

The CSS (CSS3) border-image-source property specifies path of image to be used as a border (instead of a normal border around an element).

 

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

 

Value

Description

none

(default value). No image used

url(‘URL’)

URL path to the border image

 

Default Value:

none

JavaScript syntax:

e.g. object.style.borderImageSource="url(myborder.png)"

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') 10 round;
  padding: 15px;
}
.x2 {border-image-source: url('dodecahedron.png');}
</style>
</head>
<body>
<p>1. border-image: url('NematrianLogo.png') 100% 1 .2 repeat;</p>
<p class="x2">2. with different picture ('dodecahedron.png');</p>
<p id="x3">3. as Element 2 but set using JavaScript</p>

<script>
document.getElementById("x3").style.borderImageSource =
  "url('dodecahedron.png')";
</script>

</body>
</html>

FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyBorderImageSource() {
  var x = document.createElement("DIV"); x.style.borderImageSource = "url('dodecahrehron.png')"; return (window.getComputedStyle(x, null).borderImageSource == "url('dodecahrehron.png')");
}


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile