Proponuje użycie <hr> z content: attr()
więcej przykładów: on-line (+ linear-gradient)
<hr data-text="koszyk">
hr {
overflow: visible;
padding: 0;
text-align: center;
border: none;
border-top: 2px solid black;
}
hr:after {
content: attr(data-text);
display: inline-block;
position: relative;
top: -0.5em;
font: 400 1.1em/1 system-ui;
text-transform: uppercase;
padding: 0 1em;
background-color: white;
}