-
Notifications
You must be signed in to change notification settings - Fork 675
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
[css-values] New length unit as a fractional part of rem
#9345
Comments
The one issue I see with this is that this new unit would only make sense as long as designers/developers keep using If this mutates over time to out of scope thought : I am not sure why 16px is still used so much other than "we always did it this way". Edit : Another important note about the data above is that it was generated by looking at ±50 websites we (a web agency) created and taking the values that contains the longest numbers in number-like tokens. Because division by 16 results in longer numbers this specific case is overrepresented in this data. In practice we use these more like design tokens and the large fractional part is something we only see once, when declaring the length values that will be used. :root {
--space-8--px: 8px;
--space-8--rem: 0.5rem;
--space-16--px: 16px;
--space-16--rem: 1rem;
} |
No please! You can help yourself elsewhere if you care about the readability of your code:
(even this is overkill for me personally) j.j. |
I don't think new units are needed, I think https://drafts.csswg.org/css-variables-2/#variable-units should be used instead: :root { --rp: calc(1rem / 16) }
foo { padding: 20--rp } /* 1.25rem */ |
rem
rem
Closing as wontfix per above commentary and the fact that it wouldn't add any new functionality and only a very, very slight benefit to authors at the cost of implementation, testing, educational materials, and the memory space of developers. |
Solving this with #7379 is fine with me since I don’t need this myself anyway. |
@romainmenke wrote in #9293
There are a lot of
rem
lengths in this sample, many of which are obviously the results of converting pixel values with a ratio of 16px
perrem
. All of them can be expressed bypx
values with two digits after the decimal point, or less. Assuming this is indeed a frequent way to use root-ems, there could be value in introducing a new unit which is a subdivision ofrem
corresponding 1:1 or 100:1 to default pixels, e.g.:16rp
=1rem
,1rp
≈1px
1600rx
=1rem
,1rx
≈0.01px
The text was updated successfully, but these errors were encountered: