CSS border-image

Please Share On:

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:

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright @2023. All Right Reserved.


Social media & sharing icons powered by UltimatelySocial