Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Style borderImage Property
The borderImage property is used for setting or getting the border image of an element. It is a shorthand property, so that we can manipulate borderImageSource, borderImageSlice, borderImageWidth, borderImageOutset and borderImageRepeat properties at one go.
Syntax
Following is the syntax for −
Setting the borderImage property −
object.style.borderImage = "source slice width outset repeat|initial|inherit"
Values
The property values are explained as follows −
| Sr.No |
Values & Description |
|---|---|
| 1 |
borderImageSource It specifies the image path to be used as a border. |
| 2 |
borderImageSlice It specifies the image-border inward offsets. |
| 3 |
borderImageWidth It specifies the image-border width. |
| 4 |
borderImageOutset It specifies the border image area amount by which it extends beyond the border box. |
| 5 |
borderImageRepeat It specifies that the image-border should be rounded,repeated or stretched. |
| 6 |
initial For setting this property to initial value. |
| 7 |
inherit To inherit the parent property value |
Example
Let us look at an example for the borderImage property−
<!DOCTYPE html>
<html>
<head>
<style>
#PARA1 {
border: 15px solid transparent;
padding: 12px;
border-image: url("http://www.tutorialspoint.com/images/blockchain.png") 20 stretch;
width: 100px;
}
</style>
<script>
function changeBorderImage(){
document.getElementById("PARA1").style.borderImage="url('http://www.tutorialspoint.com/im
ages/mongodb.png') 20 round";
document.getElementById("Sample").innerHTML="The border image is now changed";
}
</script>
</head>
<body>
<h2>Learning is fun</h2>
<p id="PARA1">This is a sample paragraph. Here is another line</p>
<p>Change the above paragraph border image by clicking the below button</p>
<button onclick="changeBorderImage()">Change Border Image</button>
<p id="Sample"></p>
</body>
</html>
Output
This will produce the following output −

On clicking the COLLAPSE BORDER button −

Advertisements