Open In App

How to specify the width of the border image using CSS?

In this article, we will set the width of the border image using CSS. To set the width of the border image, we use CSS border-image-width property. 

The border-image-width property is used to set the width of the border-image. It can be set by providing multiple values.



Syntax:

border-image-width: number | % | auto | initial | inherit;

Example:






<!DOCTYPE html>
<html lang="en">
  
<head>
    <title>
        How to specify the width of
        the border image using CSS?
    </title>
  
    <style>
        body {
            text-align: center;
        }
  
        h1 {
            color: green;
        }
  
        #geek1 {
            border: 10px solid transparent;
            padding: 15px;
            border-image-source:
                url(
            border-image-slice: 30;
            border-image-width: 10px 20px;
        }
  
        #geek2 {
            border: 10px solid transparent;
            padding: 10px;
            border-image-source:
                url(
            border-image-slice: 30;
            border-image-width: 1.2rem;
        }
  
        #geek3 {
            border: 10px solid transparent;
            padding: 15px;
            border-image-source:
                url(
            border-image-slice: 30;
            border-image-width: 10% 20% 10% 20%;
        }
    </style>
</head>
  
<body>
    <h1>GeeksforGeeks</h1>
  
    <h3>
        How to specify the width of
        the border-image using CSS?
    </h3>
  
    <p id="geek1">GeeksforGeeks</p>
  
    <p id="geek2">GeeksforGeeks</p>
  
    <p id="geek3">GeeksforGeeks</p>
  
</body>
  
</html>

Output:


Article Tags :