I'm looking to enhance a span with highlighted text, complete with some padding, while ensuring the surrounding text in the div stays put. Currently, the padding seems to work vertically (with the edge of my span overlapping lines above and below) but not horizontally.
Below is my CSS code:
.highlight {
background:rgba(255, 255, 0, 0.5);
font:Helvetica;
padding:4px 6px 4px 6px;
border:3px solid rgba(0, 0, 0, 0.5);
border-radius:24px;
}
For reference, here's the full jsfiddle: http://jsfiddle.net/u2rksh9u/1/
If you toggle the span by clicking within the div, you'll notice that the selected text and other text on the line shift slightly.
Is there a way to make the left and right edges of the span overlap adjacent text instead? I want to be able to apply these highlights without causing the text to move around on the screen.