HTML | DOM Style borderImageSource Property
The DOM Style borderImageSource Property is used to set or return the image to be used instead of the styles given by the border-style property.
Syntax:
- To get the borderImageSource property
object.style.borderImageSource
- To set the borderImageSource property
object.style.borderImageSource = "none | image | initial | inherit"
Property Values
- none: This sets the property to use no image.
Example-1:
<!DOCTYPE html><htmllang="en"><head><title>DOM Style borderImageSource Property</title><style>.item {height: 50px;border: 25px solid transparent;/* Setting the border before demonstratethe effect of 'none' */border-image:}</style></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style borderImageSource Property</b><p>Click on the button to changethe source of border-image</p><divclass="item">GeeksforGeeks</div><buttononclick="changeSource()">Change source of border-image</button><script>function changeSource() {elem = document.querySelector('.item');// Setting the border image source to noneelem.style.borderImageSource = "none";}</script></body></html>chevron_rightfilter_noneOutput:
- Before clicking the button:

- After pressing the button:

- Before clicking the button:
- image: This sets the image to the path specified.
Example-2:
<!DOCTYPE html><htmllang="en"><head><title>DOM Style borderImageSource Property</title><style>.item {height: 50px;border: 25px solid transparent;}</style></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style borderImageSource Property</b><p>Click on the button to change the source of border-image</p><divclass="item">GeeksforGeeks</div><buttononclick="changeSource()">Change source of border-image</button><script>function changeSource() {elem = document.querySelector('.item');// Setting the border image source to another imageelem.style.borderImageSource =}</script></body></html>chevron_rightfilter_noneOutput:
- Before clicking the button:

- After clicking the button:

- Before clicking the button:
- initial: This is used to set this property to its default value.
Example-3:
<!DOCTYPE html><htmllang="en"><head><title>DOM Style borderImageSource Property</title><style>.item {height: 50px;border: 25px solid transparent;/* Setting the border before todemonstrate the effect of 'initial' */border-image:}</style></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style borderImageSource Property</b><p>Click on the button to change the source of border-image</p><divclass="item">GeeksforGeeks</div><buttononclick="changeSource()">Change source of border-image</button><script>function changeSource() {elem = document.querySelector('.item');// Setting the border image source to initialelem.style.borderImageSource = "initial";}</script></body></html>chevron_rightfilter_noneOutput:
- Before clicking the button:

- After pressing the button:

- Before clicking the button:
- inherit: This is used to inherit the property from its parent.
Example-4:
<!DOCTYPE html><htmllang="en"><head><title>DOM Style borderImageSource Property</title><style>.item {height: 50px;border: 25px solid transparent;}#parent {/* Setting the border of parentdemonstrate the effect of 'inherit' */border-image:}</style></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style borderImageSource Property</b><p>Click on the button to changethe source of border-image</p><divid="parent"><divclass="item">GeeksforGeeks</div></div><buttononclick="changeSource()">Change source of border-image</button><script>function changeSource() {elem = document.querySelector('.item');// Setting the border image source// to inherit from its parentelem.style.borderImageSource = "inherit";}</script></body></html>chevron_rightfilter_noneOutput:
- After pressing the button:

Before clicking the button:
Supported Browsers: The browser supported by borderImageSource Property are listed below:
- Chrome
- Internet Explorer 11.0
- Firefox
- Safari 6.0
Recommended Posts:
- HTML | DOM Style top Property
- HTML | DOM Style right Property
- HTML | DOM Style borderTopLeftRadius Property
- HTML | DOM Style textDecorationColor Property
- HTML | DOM Style lineHeight Property
- HTML | DOM Style animationFillMode Property
- HTML | DOM Style animationDuration Property
- HTML | DOM Style wordSpacing Property
- HTML | DOM Style listStyle Property
- HTML | DOM Style flexBasis Property
- HTML | DOM Style borderStyle Property
- HTML | DOM Style textAlign Property
- HTML | DOM Style borderBottomRightRadius Property
- HTML | DOM Style borderBottomStyle Property
- HTML | DOM Style borderBottomWidth Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



