Skip to content

[css-grid] fr unit and other length units #955

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
ylafon opened this issue Jan 18, 2017 · 6 comments
Closed

[css-grid] fr unit and other length units #955

ylafon opened this issue Jan 18, 2017 · 6 comments

Comments

@ylafon
Copy link
Member

ylafon commented Jan 18, 2017

grid defines the 'fr' unit as a flexible length, how does this kind of length relates to relative and absolute lengths that are defined in https://www.w3.org/TR/css3-values/#lengths ?
What would be the behaviour if 1fr was used as the width of an element?
The definition should be more explicit about the scope of this unit and its relationship to other length units.

@SelenIT
Copy link
Collaborator

SelenIT commented Jan 18, 2017

The CSS Grid Layout spec actually doesn't define the fr unit as a length unit of any kind. Instead, it introduces the new dimension type — "Flexible Length", which can currently be used in one context only — for a size of a grid track, which is defined as

<track-breadth> = <length-percentage> | <flex> | min-content | max-content | auto

(where <flex> is this new dimension type).

Since the width property is defined as

[<length> | <percentage>] | available | min-content | max-content | fit-content | auto

which doesn't allow <flex> type of value, width: 1fr would be an invalid declaration, just like width: 1deg, width: 500Hz and so on. I don't see any ambiguity in the current definition

@ylafon
Copy link
Member Author

ylafon commented Jan 19, 2017

Yes, I saw that it was defined as a "Flexible Length", but the fact that it is not a "length" despite its name (unlike "relative length" and "absolute length") would deserve a better definition in the spec (and ideally be moved to the css-values spec), as in other specifications, it is quite common to use "length" and not "length, but not of the flexible kind, as it is not a real length".

@SelenIT
Copy link
Collaborator

SelenIT commented Jan 23, 2017

Agree. Maybe we should raise a "meta-issue": do all CSS dimensions and values defined anywhere (even in one module only) need to be reflected in css-values? At least, I believe that they should have a special section in CSS Indexes page.

@tabatkins
Copy link
Member

The CSS Grid Layout spec actually doesn't define the fr unit as a length unit of any kind.

Yup. We refer to it colloquially as a "length", because it serves a similar purpose, but it's very specifically not a subtype of <length> in the spec. Using it in 'width' would be invalid due to grammar reasons.

Maybe we should raise a "meta-issue": do all CSS dimensions and values defined anywhere (even in one module only) need to be reflected in css-values?

Our general rule is that anything which is widely applicable across specs belongs in the V&U spec. Specialized dimensions don't need to live there, but all <length>s are CSS-wide, and should have their definitions in V&U.

@fantasai
Copy link
Collaborator

fantasai commented Feb 1, 2017

We need to clarify whether fr units represent lengths and are combinable with them in calc().

@dbaron
Copy link
Member

dbaron commented Mar 15, 2017

This was discussed in today's teleconference concluding with:

RESOLVED: length & frs are not combinable, but will reconsider if/when length & auto are combinable

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