Skip to content

[css-values] Add the ''lh'' and ''rlh'' units #602

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

Merged
merged 1 commit into from
Jan 3, 2017
Merged

Conversation

frivoal
Copy link
Collaborator

@frivoal frivoal commented Oct 14, 2016

@frivoal frivoal added the css-values-4 Current Work label Oct 14, 2016
@tabatkins
Copy link
Member

While this copies the circularity-breaker of font-size/em in handling line-height using lh, it doesn't address the new cycle we're adding when font-size uses lh and line-height uses em.

We can either break this situation by making both refer to the parent element's metrics, or by just making one of them refer to the parent element and letting the other one rely as usual.

I think I prefer treating the em unit as slightly more fundamental, so that line-height/em will use the parent element's metrics, and then font-size/lh will just rely on the element's metrics as usual. However, I could easily be convinced otherwise by a decent argument. We probably want to poll implementors on what seems best to them.

@frivoal
Copy link
Collaborator Author

frivoal commented Nov 23, 2016

While this copies the circularity-breaker of font-size/em in handling line-height using lh, it doesn't address the new cycle we're adding when font-size uses lh and line-height uses em.

I'm not seeing it.

What happens to the font-size when it is defined in lh is addressed: I did not add a new paragraph for that, but the existing one about the exception to font-size is for all font-relative length units, and lh is classified as one.

And as long as you have that, it doesn't matter that the line-height depends on the font-size (which it does even if you don't use ems, and use percentages or unitless numbers), since there's no loop.

Did you miss that, or am I missing something else? Can you give an example of this loop you're seeing and that I am not?

I think I prefer treating the em unit as slightly more fundamental, so that line-height/em will use the parent element's metrics, and then font-size/lh will just rely on the element's metrics as usual.

How would that work when line-height, instead of being in em, is a naked number or a % or its initial value of normal? In that case, it still depends on font-size, so that would be causing a loop, wouldn't it?

@frivoal
Copy link
Collaborator Author

frivoal commented Nov 23, 2016

If you agree (or if we end up agreeing on something else), I'm happy to submit tests to make sure that the next person looking at this doesn't miss on the subtlety.

@frivoal
Copy link
Collaborator Author

frivoal commented Dec 5, 2016

@tabatkins Could you follow up on that review?

@fantasai
Copy link
Collaborator

fantasai commented Jan 3, 2017

I think it would be surprising if line-height: 1em; didn't make the line height exactly match the font size. On the other hand, I can see that font-size: 1lh to make the font size match the parent line-height would be useful. So I think that's a better way to break it down.

@fantasai fantasai merged commit c42ab51 into w3c:master Jan 3, 2017
@fantasai
Copy link
Collaborator

fantasai commented Jan 3, 2017

Accepting the pull request. We can fix up the cycle issue if needed as an additional commit, since it's very simply additive.

@frivoal frivoal deleted the lh-rlh branch June 5, 2020 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-values-4 Current Work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants