How to make text selection in CSS color? The highlight color can be in RGBA format, i.e. with transparency.

enter image description here

This means no selection by the cursor. And initially the text is highlighted.

    1 answer 1

    div { color: #fff; max-width: 400px; text-align: center; } div > span { padding: 3px 0; line-height: 1.45; background: rgba(20,172,211,.5); box-shadow: 10px 0 rgba(20,172,211,.5), -10px 0 rgba(20,172,211,.5); } 
     <div><span>Как в CSS сделать выделение текста цветом? Цвет выделения может быть в RGBA-формате, т.е. с прозрачностью.</span> </div>