Set image as a border for elements with CSS

CSSWeb DevelopmentFront End Technology

CSS border-image property is used to add image border to some elements. You can try to run the following code to set the image as a border for elements:

Example

Live Demo

<html>
   <head>
      <style>
         #borderimg1 {
            border: 10px solid transparent;
            padding: 15px;
            border-image-source: url(/css/images/border.png);
            border-image-repeat: round;
            border-image-slice: 30;
            border-image-width: 10px;
         }
         #borderimg2 {
            border: 10px solid transparent;
            padding: 15px;
            border-image-source: url(/css/images/border.png);
            border-image-repeat: round;
            border-image-slice: 30;
            border-image-width: 20px;
         }
         #borderimg3 {
            border: 10px solid transparent;
            padding: 15px;
            border-image-source: url(/css/images/border.png);
            border-image-repeat: round;
            border-image-slice: 30;
            border-image-width: 30px;
         }
      </style>
   </head>
   <body>
      <p id = "borderimg1">This is image border example.</p>
      <p id = "borderimg2">This is image border example.</p>
      <p id = "borderimg3">This is image border example.</p>
   </body>
</html>
raja
Published on 02-May-2018 10:34:04
Advertisements