Open In App

CSS border-image Property

The border-image property in CSS is used to set the border of an element. 

Syntax:



border-image: source slice width outset repeat|initial|inherit;

The border-image property is the combination of many properties which are listed below:

Property Values:



Syntax:

border-image-source: url(image source location);

Syntax:

border-image-width: value;

Syntax:

border-image-outset: value;

Syntax:

border-image-repeat: value;

Example 1: 




<!DOCTYPE html>
<html>
<head>
    <title>
        CSS border-image Property
    </title>
 
    <style>
        #borderimg1 {
            border: 10px solid transparent;
            padding: 15px;
            -webkit-border-image: url(
            border-image: url(
            text-align: center;
        }
 
        #borderimg2 {
            border: 10px solid transparent;
            padding: 15px;
            -webkit-border-image: url(
            border-image: url(
            text-align: center;
        }
    </style>
</head>
 
<body>
    <h2>border-image property</h2>
 
    <p id="borderimg1">
        Element Content
    </p>
    <p id="borderimg2">
        Element Content
    </p>
</body>
</html>

Output:

 Example 2: 




<!DOCTYPE html>
<html>
<head>
    <title>
        CSS border-image Property
    </title>
 
    <style>
        #borderimg1 {
            border: 15px solid transparent;
            padding: 15px;
            border-image: url(
        }
 
        #borderimg2 {
            border: 15px solid transparent;
            padding: 15px;
            border-image: url(
        }
 
        #borderimg3 {
            border: 15px solid transparent;
            padding: 15px;
            border-image: url(
        }
    </style>
</head>
 
<body>
    <h2>border-image property</h2>
    <p id="borderimg1">BORDER 1</p>
    <p id="borderimg2">BORDER 2</p>
    <p id="borderimg3">BORDER 3</p>
</body>
</html>

Output: 

Supported Browsers: The browser supported by the border-image property are listed below:


Article Tags :