Skip to content

[css-text-decor-4] text-underline-offset and text-underline-width has no easy way of being proportional to font size #3121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
litherum opened this issue Sep 16, 2018 · 7 comments

Comments

@litherum
Copy link
Contributor

https://drafts.csswg.org/css-text-decor-4/#underline-offset

Perhaps it should also take a percentage, which gets multiplied by the font size?

@litherum litherum changed the title text-underline-offset has no way of being proportional to font size [css-text-decor-4] text-underline-offset has no way of being proportional to font size Sep 16, 2018
@litherum
Copy link
Contributor Author

litherum commented Sep 16, 2018

<div id="outer" style="font-size: 32px; text-underline-offset: 12.5%;">
    <div id="inner" style="font-size: 16px; text-decoration: underline;"> ... </div>
</div>

The observed offset on the inner element should be 2px

<div id="outer" style="font-size: 32px; text-underline-offset: 12.5%; text-decoration: underline;">
    <div id="inner" style="font-size: 16px;> ... </div>
</div>

The observed offset on the inner element should be 4px because of the decorating box.

@litherum
Copy link
Contributor Author

Also, text-underline-width should get it too.

@litherum litherum changed the title [css-text-decor-4] text-underline-offset has no way of being proportional to font size [css-text-decor-4] text-underline-offset and text-underline-width has no easy way of being proportional to font size Sep 16, 2018
@benface
Copy link

benface commented Sep 17, 2018

Would it make sense to introduce a new unit that is relative to the font size like em but that doesn't compute to an absolute value? Also for #2165.

@litherum
Copy link
Contributor Author

Wait a minute. Why wouldn’t text-underline-offset: 0.125em work?

@benface
Copy link

benface commented Sep 17, 2018

Same problem as #2165, it would work as long as it's set on every element that inherits it and changes the font-size.

@litherum
Copy link
Contributor Author

Ah, I see. Cool.

@litherum
Copy link
Contributor Author

The resolution for #2165 should cover this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants