I made some small sprites for the user for another Stack site . It overlays some icon elements on the page that look like Magic: the Gathering mana symbols using a sprite sheet . The code snippet at the end is a sample of its output.
All icons contain a hidden text element (using Bootstrap.sr-only ), which is the equivalent of a plain text symbol. This means that you can select the text around them, copy and paste them to get useful plain text! For example, if I ran the code snippet below, select the following and press CTRL + C:

Then I copied these: → {W} {U} {B} {R} {G} ←to my clipboard and can paste it to another location. This is very useful, and exactly what I want. However, the characters do not look , because they are selected with the text around them, even if they are - all the text is clearly selected, the characters themselves are not; and it’s weird for the user and intricate damage for the user, which I would prefer to overcome. If it is selected, how it can be copied and pasted, it should look like this.
(At least it works this way in Chrome and Firefox on Windows.)
How can I ensure that these elements look as if they are highlighted in the same way as plain text?
, HTML, ( , ). , .
body {
font-family: sans-serif;
}
.mana-symbol {
display: inline-block;
width: 16px;
height: 16px;
background: url('//i.stack.imgur.com/kF1U5.png') no-repeat black;
background-size: 169px;
position: relative;
top: 0.2em;
box-shadow: 1px 1px 0px 0px #000;
border-radius: 8px;
}
.mana-symbol .sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
border: 0;
}
.mana-symbol.W { background-position: -68px -34px }
.mana-symbol.U { background-position: -85px -34px }
.mana-symbol.B { background-position: -102px -34px }
.mana-symbol.R { background-position: -119px -34px }
.mana-symbol.G { background-position: -136px -34px }
try selecting, copying and pasting these: →
<span class="mana-symbol W"><span class="sr-only">{W}</span></span>
<span class="mana-symbol U"><span class="sr-only">{U}</span></span>
<span class="mana-symbol B"><span class="sr-only">{B}</span></span>
<span class="mana-symbol R"><span class="sr-only">{R}</span></span>
<span class="mana-symbol G"><span class="sr-only">{G}</span></span>
←
Hide resultscript 32px 16px ( ). , . , . ( SVG) , .
, :
: . , micku on github, . ahkren of Small Magic.