Skip to content
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-sizing-4][css-grid-2][css-align-4] Rename 'ar' unit? #3225

Closed
fantasai opened this issue Oct 18, 2018 · 7 comments
Closed

[css-sizing-4][css-grid-2][css-align-4] Rename 'ar' unit? #3225

fantasai opened this issue Oct 18, 2018 · 7 comments

Comments

@fantasai
Copy link
Collaborator

@jensimmons was wondering if we should rename the ar unit to something else, since it's not exactly an aspect ratio. Not sure what, though. Maybe tr for “transfer ratio”?

@jonjohnjohnson
Copy link

jonjohnjohnson commented Oct 18, 2018

What if we didn't add a new unit type exactly, but made it so box size properties could instead just accept a "unit-less" float that always represents the ratio/relationship of the dimension of the property it is declared upon to its opposing axis? Or possibly always block to inline size regardless of declared property?

height: 2;
width: calc(1 / 3);
block-size: 1.5
min-inline-size: 3

I know this is still adding a new *unit, just a slightly different way about the syntax?

https://drafts.csswg.org/css-sizing-4/#ratios

@astearns
Copy link
Member

@jonjohnjohnson we're not likely to add any new unit-less values in CSS. Over the years we have found it's much better to be explicit about what the numbers in CSS values mean.

@jonjohnjohnson
Copy link

@astearns I've noticed that and find it understandable, especially for typing. I just wasn't sure of the value in adding new unit types piecemeal.

Though fr for grid (and the unit-less values for flex grow/shrink) are fractions of available space. Would it be too confusing for an fr unit on a box size property to behave as a "fraction" of the computed value of an opposing axis?

@fantasai
Copy link
Collaborator Author

@jonjohnjohnson There's a decent chance we'll want to allow this as a track size in Grid, at which point it needs to not conflict with fr. :)

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed Renaming ar unit.

The full IRC log of that discussion <fantasai> Topic: Renaming ar unit
<fantasai> github: https://github.com//issues/3225

@jensimmons
Copy link
Contributor

I thought about this a lot on the plane from TPAC to View Source today. @fantasai wants to use a two character unit where the second letter is an 'r', so that it matches 'fr' well. So I make a list of every combination: ar, br, cr, dr, etc... and crossed out all the ones that don't work (like br, ir, lr... too confusing or weird).

Purely looking at letter combinations, and thinking about what something-'r' units we might make up in the future, these are options:

  • The best letter combo options (imho): kr, mr, tr
  • Others that also sort of work: ar, dr, gr, jr, nr, qr, sr, wr, xr, yr, zr

tr is a really good combination. So I started thinking about what tr could stand for. I don't like using ratio in the name, because it's not really a ratio. Or at least it's not a ratio in the way that an aspect ratio is a ratio.

But then I started realizing, well, fr doesn't stand for "fraction r-something". fr stands for FRaction. And hey, transfer is also a word that has an 'r' as it's second letter. TRansfered. So I propose we do use tr, but we do not include the word ratio. Instead we say "transferred length", or better, the phrase @rachelandrew said at the face to face this week, "transferred size".

TR stands for TRansfered size. Or TRansfer.
Just like FR stands for FRaction. Or FRaction of the available space.

@Archibald2
Copy link

Archibald2 commented Oct 25, 2018

This issue is also being discussed in #333 and #1173.

The "tr" (or "ar") unit either relates the width to the height or relates the height to the width. I think this could be confusing. Code would be easier to read if '%w' is used for width and '%h' is used for height. So for example;

div {
min-height: 100%w;
}
article {
max-width: 150%h
}

"%w" and "%h" are only suggestions: they could be just "w" and "h" (subject to comments in other threads).

If "tr" is favoured, I suggest it should be a percentage value like "vw" and "vh" (as was proposed for "ew")..

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

6 participants