Selected text border


I want to create a border that bounds around selected text region

I tried this:

.selection .region {
    border: 1px solid white;

And got this:

I understand why I got this result (this is because selection region is divided into mutiple boxes, each box has a border). But I don’t want any line between 2 selected lines, I just want border between selected region and unselected region.

Can anyone help me?

PS: I’m not good at CSS though


There’s a package for that.


Awesome, thanks.