<p>
  <span>An inline element with the default box-decoration-break: slice.</span>
</p>

<p>
  <span class="clone">An inline element using box-decoration-break: clone.</span>
</p>
p {
  max-width: 150px;
  line-height: 2;
}

span {
  background-color: #002856;
  color: #fff;
  border-radius: 0.5em;
  border: 2px solid black;
}

.clone {
  box-decoration-break: clone;
}

body {
  font-family: Roboto, sans-serif;
  padding: 2em;
}

External CSS

  1. https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&amp;display=swap

External JavaScript

This Pen doesn't use any external JavaScript resources.