I have an application that uses the <mark> to interactively highlight text. When the user drags the mouse, it wraps and expands the text nodes in the document to show the user the choice. When the selected range ends in the middle of the word, the label surrounds only part of the word. If the boundary is between a nuclear pair, kerning is disabled.
Here is an example:
p { font-size: 30pt; margin: 0; line-height: 26pt; }
<p>There <mark>are 1</mark>1 entries.</p> <p>There are 11 entries.</p>
In the first paragraph, the <mark> tag ends between the two digits "1". The second paragraph has the same text without the <mark> character. Font size, margin, and line spacing are adjusted to fit paragraphs to make differences more noticeable.
There is more space between 1 with the <mark> symbol than without. Since this happens interactively in the application, as the user drags the mouse over 1s, the subsequent text moves to the right when they are between 1s and then backward when they pass the next character. Shuffling text can be annoying.
Is there a way to tell the browser not to treat tag labels as a kerning border? Maybe a font setting?
source share