I made a model using pseudo-element even, because this way I can better control the contour and curvatures. I know it wasn’t exactly the same, but sometimes it suits you...
I didn’t need to touch anything in your HTML, just in the box where the text is inside I create a ::before
and ::after
Those "keys" [ ]
will always have the height of the content, so no matter if it has a lot or little text, the "keys" will always fit with the content.
The trick here was to build a rectangle on each side of the text box and remove the border from within that square, to make the corners rounded just use border-radius
. But as I said at the beginning it doesn’t exactly look like the image
.indicacoes {
font-family: 'AmaticBold';
font-size: 40px;
margin-top: 30px;
text-align: center;
}
.texto-principal {
padding: 1rem;
width: 50%;
margin: 1rem auto;
position: relative;
}
.texto-principal::after,
.texto-principal::before {
content: "";
position: absolute;
top: 0;
width: 4em;
height: 100%;
border: .5em solid currentColor;
border-radius: .5em;
}
.texto-principal::after {
left: 0;
border-right: 0;
}
.texto-principal::before {
right: 0;
border-left: 0;
}
<div class="container">
<div class="texto-principal">
<p id="borderimg" class="indicacoes">
texto de teste! <br>
TEXTO TEXTO TEXTO TEXTO. <br>
TEXTO TEXTO TEXTO.
</p>
</div>
</div>
Will the text there always have a maximum of 3 lines? It can be with SVG?
– hugocsl