3

I have background image which is needed to be repeated to it's content like that: like that

But using this code:

.imgbord {
  background: url('https://i.imgur.com/LGlfFuU.png');
  background-repeat: round;
  color: white;
}
<div style="margin: 42px auto; width: 75%;">
  <div class="imgbord">some random content out here</div>
</div>

I get this:

i get this

Temani Afif
  • 245,468
  • 26
  • 309
  • 415
Jack Glow
  • 51
  • 1
  • 13

1 Answers1

4

I guess you are looking for border-image

.imgbord {
  border:4px solid transparent;
  border-image: url('https://i.imgur.com/LGlfFuU.png') 4 fill round;
  color: white;
  padding:50px;
  display:inline-block;
  margin:10px;
}

body {
  background:grey;
}
<div class="imgbord">some random content out here</div>


<div class="imgbord">some content</div>

Related to understand how it works and how to adjust the values: https://stackoverflow.com/a/56915094/8620333

Temani Afif
  • 245,468
  • 26
  • 309
  • 415