Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-line text border issue with span tag

Tags:

html

text

css

I've a header text which has a border around it. A larger text has two lines, but the border breaks. So, I applied the CSS style box-decoration-break: clone;. But this separates the text into two different blocks like in the attached screen. Is it possible to display the border completely around the text?

enter image description here

Need to implement like this:

enter image description here

HTML like this;

<span class="border-title">
  LOREM IPSUM DUMMY CONTENT LOREM IPSUM DUMMY CONTENT
</span
>

CSS Style applied;

.border-title {
  color: #264755;
  text-transform: uppercase;
  font-size: 24px;
  border: 1px solid #3cadca;
  padding: 10px 20px 5px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
like image 548
Arun Chandran Avatar asked Oct 17 '25 13:10

Arun Chandran


1 Answers

add property display: inline-block;

.border-title {
 border: 1px solid blue;
 display: inline-block;
}
<div style="max-width: 300px;"><span class="border-title">LOREM IPSUM DUMMY CONTENT LOREM IPSUM DUMMY CONTENT</span></div>