The border-image property in CSS is used to specify the border of an image. This property creates a border using an image instead of a normal border. The property contains three-part that are listed below:
- Complete image is used as border.
- Slice of image is used as border
- Middle section of image is used (repeated or stretched) as border
The border-image property is used to slice an image into nine sections, like a tic-tac-toe board.
Syntax:
element {
border-image: url(border.png);
}
border-image properties: There are many border-image property which are listed below:
- border-image-source: This property is used to set the image path.
- border-image-width: This property is used to set the width of boarder image.
- border-image-slice: This property is used to slice the border of the image.
- border-image-repeat: This property is used to set the border of the image as rounded, repeated and stretched.
- border-image-outset: This property is used to specify the amount by which the border image area extends beyond the border box.
Example:
<!DOCTYPE html> <html> <head> <title> CSS | Border Images </title> <style> body { text-align:center; } h1 { color:green; } .border1 { border: 10px solid transparent; padding: 15px; border-image-source: url( border-image-repeat: round; border-image-slice: 30; border-image-width: 20px; } .border2 { border: 10px solid transparent; padding: 15px; border-image: url( 30 stretch; } .border3 { border: 10px solid transparent; padding: 15px; border-image: url( 20% round; } div { margin-top:20px; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>border-image property</h2> <div class = "border1">Border 1</div> <div class = "border2">Border 2</div> <div class = "border3">Border 3</div> </body> </html> |
Output:

Supported Browsers: The browsers supported by border-image property are listed below:
- Google Chrome 16.0
- Internet Explorer 11.0
- Firefox 15.0
- Opera 15.0
- Safari 6.0
Recommended Posts:
- Semantic-UI | Images
- CSS | Polaroid Images
- Bootstrap 4 | Images
- HTML | Images
- CSS | Styling Images
- How to set multiple background images using CSS?
- How to put images in a box without space using Bootstrap?
- Loading Images in Tkinter using PIL
- How to display images in Angular2 ?
- Python | Display images with PyGame
- SASS variable for images path
- How to download Google Images using Python
- How to use grid for images in bootstrap card ?
- Responsive images in Bootstrap with Examples
- Python | Uploading images in Django
- HTML | DOM images Collection Property
- Python - Process images of a video using OpenCV
- Why card images use data-src (not src) for image in Bootstrap 4 ?
- How to align images in card with dynamic title?
- How to display multiple horizontal images in Bootstrap card ?
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.


