HTML CSS examples for CSS Property:border-image
The border-image CSS property sets how an image is used for border styles.
This is a shorthand property for setting border-image-source, border-image-slice, border-image-width, border-image-outset and border-image-repeat properties at once.
The following table summarizes the border-image Property.
Item | Value |
---|---|
Default value: | none 100% 1 0 stretch; See individual properties |
Applies to: | All elements, except internal table elements when border-collapse is collapse. It also applies to ::first-letter. |
Inherited: | No |
Animatable: | No. |
The syntax of the property is as follows:
border-image: [ source slice width outset repeat ] | initial | inherit
The following table describes the values of this property.
Value | Description |
---|---|
border-image-source | Set the location of the image. |
border-image-slice | Set the inward offsets from the top, right, bottom, and left edges. |
border-image-width | Set the width of the border. |
border-image-outset | Set the amount where the border image area extends beyond the border box. |
border-image-repeat | Set how the middle part of the border image are scaled or tiled to match the size of the border. |
initial | Sets this property to its default value. |
inherit | take the value of its parent element border-image property. |
The example below shows the border-image property.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of CSS3 border-image Property</title> <style type="text/css"> .box {<!-- w w w.j a v a 2 s. c o m--> width: 300px; height: 150px; border: 15px solid transparent; -webkit-border-image: url("https://www.java2s.com/style/demo/Opera.png") 30 30 round; /* Safari 3.1-5 */ -o-border-image: url("https://www.java2s.com/style/demo/Opera.png") 30 30 round; /* Opera 11-12.1 */ border-image: url("https://www.java2s.com/style/demo/Opera.png") 30 30 round; } </style> </head> <body> <div class="box"></div> </body> </html>