-
Notifications
You must be signed in to change notification settings - Fork 757
Closed
Description
There are a couple problems with the current formulation of text-underline-offset.
text-underline-offsetis meant to be a delta added to wherever the underline happened to be placed, but the location where the underline is placed varies between different browsers and operating systems. The use case this is supposed to solve is "my underline is just a little too high, let's nudge it down a little bit" but because different browsers choose the locations differently, the current formulation doesn't satisfy this use case- What does it mean if both
text-underline-offset: from-fontandtext-underline-position: underare applied to the same element? Such a formulation seems fairly meaningless.
In order to fix these problems, I propose the following changes:
- Add another value to
text-underline-positionnamed something likestandard. Come up with some standard formula for the placement of the underline that all browsers can agree on, and state it in the spec. Importantly, don't make this the initial value - it's just an option that authors can specify if they want consistent underlines. I'm not particular on what specific formula is used, but I'll proposefont-size / 16to get the conversation started. (This formula scales linearly with font size, and default-sized text gets a 1px underline gap, which is compatible with most (all?) browsers today) - Move the
from-fontvalue fromtext-underline-offsettotext-underline-position. - Update the grammar of
text-underline-positionsuch that you can't specify more than one of [auto, standard, under, from-font]. - Now,
text-underline-offsetreally can be just a delta, so there's no need for anautovalue. Remove theautovalue and have it just take a<length>. - While we're at it,
text-underline-offsetshould be able to take a percentage, which gets multiplied by the font size. This would be a good way to make the underline scale as the font size grows.