A
A
Andrey Yugay2014-10-01 23:11:15
css
Andrey Yugay, 2014-10-01 23:11:15

Is it possible to change the height of the selection in an input?

08255d7676d34c07b4997193a1668eee.png
Is it possible and how to change the height of the text selection (yellow) using css?
Or just change the height of the characters directly in the font (adding white space above and below)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Petrov, 2014-10-02
@mcmimik

Unfortunately, when calculating the dimensions of the ::selection pseudo-element, the line-height-to-font-size ratio hardwired into the font is taken into account.
You can change the line-height to your heart's content, but nothing will change for this pseudo-element. The only rules available are color , background-color , in most modern browsers text-shadow .
Apparently, there is still no consensus on the selected fragment, because even in the specification section 7.3 is left empty

This section intentionally left blank. (This section previously defined a ::selection pseudo-element.)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question