How to create Border Images in CSS

CSSWeb DevelopmentFront End Technology

To create border images in CSS, use the border-image property. Following is the code to create border images in CSS −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
body {
   font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
.border1 {
   border: 10px solid transparent;
   padding: 15px;
   border-image: url("https://i.picsum.photos/id/677/200/300.jpg") 30 round;
}
.border2 {
   border: 10px solid transparent;
   padding: 15px;
   border-image: url("https://i.picsum.photos/id/677/200/300.jpg") 2% round;
}
</style>
</head>
<body>
<h1>Border image in CSS</h1>
<p class="border1">Some random sample text inside the paragraph</p>
<p class="border2">Some random sample text inside the paragraph</p>
</body>
</html>

Output

The above code will produce the following output −

raja
Published on 11-May-2020 13:28:45
Advertisements