The CSS border-image is used to style any borders by using an image.
Note: Internet Explorer 11 and earlier versions do not support CSS border-image properties.
Let’s see with an example. How does CSS style your border when applying the border’s image?
Here is the original image. Let’s use this image as a border-image:
See below the 5 different styles of border-image. You can use your own custom border image according to your border style. This is just an example to show how you use border-image.
Source Code:
<!DOCTYPE html>
<html>
<head>
<style>
#borderimage1 {
border: 15px dashed transparent;
padding: 5px;
border-image: url(http://www.elsebazaar.com/blog/wp-content/uploads/2019/03/About-Us-image.jpg) 90 round;
}
#borderimage2 {
border: 12px dotted transparent;
padding: 15px;
border-image: url(http://www.elsebazaar.com/blog/wp-content/uploads/2019/03/About-Us-image.jpg) 30 stretch;
}
#borderimage3 {
border: 2px dotted transparent;
padding: 15px;
border-image: url(http://www.elsebazaar.com/blog/wp-content/uploads/2019/03/About-Us-image.jpg) 30 stretch;
}
#borderimage4 {
border: 2px solid transparent;
padding: 5px;
border-image: url(http://www.elsebazaar.com/blog/wp-content/uploads/2019/03/About-Us-image.jpg) 30% round;
}
#borderimage5 {
border: 12px solid transparent;
padding: 5px;
border-image: url(http://www.elsebazaar.com/blog/wp-content/uploads/2019/03/About-Us-image.jpg) 50% round;
</style>
</head>
<body>
<h1>The border-image Property</h1>
<p>See the border-image property use</p>
<p id="borderimage1">border image style 1</p>
<br/>
<p id="borderimage2">border image style 2</p>
<br/>
<p id="borderimage3">border image style 3</p>
<br/>
<p id="borderimage4">border image style 4</p>
<br/>
<p id="borderimage5">border image style 5</p>
</body>
</html>
Result:
The border-image Property
See the border-image property use
border image style 1
border image style 2
border image style 3
border image style 4
border image style 5
Donate to support writers
You may be interested in the following topics:
- CSS border-image-width
- CSS border-image-source
- CSS border-image-slice
- CSS border-image-repeat
- CSS border-image-outset
- CSS border-image
- CSS border-collapse
- CSS border-bottom-right-radius
- CSS border-bottom-left-radius
- CSS border-top-right-radius
- CSS border-top-left-radius
- CSS border-radius
- CSS border-left-width
- CSS border-left-style
- CSS border-left-color
- CSS border-left
- CSS border-bottom-width
- CSS border-bottom-style
- CSS border-bottom-color
- CSS border-bottom
- CSS border-right-width
- CSS border-right-style
- CSS border-right-color
- CSS border-right
- CSS border-top-width
- CSS border-top-style
- CSS border-top-color
- CSS border-top
- CSS border-width
- CSS border-style
- CSS border
- CSS Border (All Properties)