Skip to content

[css-align][css-grid][css-flex] Baseline alignment not implemented due to lack of specs #372

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
FremyCompany opened this issue Aug 2, 2016 · 9 comments
Assignees
Labels
Closed Accepted as Editorial Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-align-3 Current Work css-flexbox-1 Current Work css-grid-1 Tracked in DoC

Comments

@FremyCompany
Copy link
Contributor

I started the baseline review, but I’m wondering why flexbox and grids rows are said to have baselines, and how those baselines should work.
As far as I know, you cannot baseline-align stuff in a grid or in a flexbox, there is just no part of the algorithm that keep track of those things. What are your expectations here?

I have no idea why you think this, as grid and flex items all have an align-self: baseline value.

Flexbox does have some text talking about baseline support, indeed:
http://www.w3.org/TR/css-flexbox-1/#cross-sizing

However, it seems the Microsoft implementation of grids didn't have a similar baseline-align value and, correct me if I'm wrong, the current Blink implementation doesn't support the value either. Supporting the value would, as far as I understand, require significant changes to the track-sizing algorithms to keep track on these above/below the baseline measurements, like we do in css-tables.

I am therefore not sure the baseline section that was added to the spec "compiles" right now:
https://drafts.csswg.org/css-grid/#grid-baselines

I think the topic should be brought to discussion in the working group. We should either clarify that grid does not support baseline-alignment (ignores the value) or that it does, and reflect that in the algorithms. I am not sure this is something our team is willing to put in the Level 1 version of the spec, though. I personally never understood why you would want to baseline-align things in a table, but I guess some people use it for some reason.

@FremyCompany FremyCompany changed the title [css-align][css-grid][css-flex] [css-align][css-grid][css-flex] Baseline alignment not implemented due to lack of specs Aug 2, 2016
@tabatkins
Copy link
Member

tabatkins commented Aug 2, 2016

No, I'm pretty sure Grid already handles this fine. Over in Align, baseline alignment is defined as:

effectively increases the margins on the box to align its alignment baseline with other baseline-aligned boxes in its group.

(or padding, for content alignment)

And then Grid just operates on min/max-content contributions, which include the margins of the element.

We think there is something missing - spanning elements need to first/last-baseline align with the stuff in its first/last row or column, but that's just a clarification to how grid items collect into baseline-sharing groups.

@tabatkins
Copy link
Member

Wait, never mind, Align already says that:

If a box spans multiple shared alignment contexts, it participates in first (last) baseline self-alignment within its start-most (end-most) shared alignment context along that axis.

@FremyCompany
Copy link
Contributor Author

I am still confused about what things should be doing. Let's take align-content:baseline, what is it supposed to do, and how?

image

Since the specs doesn't define algorithms but just intents, it would be good to have more examples ;-)

@tabatkins
Copy link
Member

Baseline content-alignment only works between things in "row-like contexts" https://drafts.csswg.org/css-align/#baseline-align-content - table cells, flex items, and grid items. Inline-level boxes (such as an inline-grid container) are not on that list, so they don't participate in baseline content-alignment. (We can clarify the spec a bit here.)

So you can content-align the grid items in the container with each other (they'll get magic-padding to make their baselines align), but the grid container itself can't be baseline content-aligned in this context. (Only thing you can do is use vertical-align.)

@FremyCompany
Copy link
Contributor Author

Are there contexts in which you should be able to baseline-align a grid container? If the grid is inside a flexbox, for instance, how would align-content work in this case? Adding a padding-top to the grid?

@fantasai
Copy link
Collaborator

fantasai commented Aug 3, 2016

Yes, exactly. (Well, conceptually. The computed/used value of padding-top does not change.)

@fantasai
Copy link
Collaborator

fantasai commented Aug 3, 2016

92cbf50 clarifies that boxes not in a shared alignment context do not baseline-align; they use the fallback alignment (start/end depending on first/last baseline).

Let me know if you need any further clarifications.

@FremyCompany
Copy link
Contributor Author

Thanks, I think things are clear again; let's close for now and I'll reopen if we can come up with another question.

@FremyCompany
Copy link
Contributor Author

Just no to loose the image:
image

@fantasai fantasai added the Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. label May 3, 2017
@fantasai fantasai added this to the Published css-flexbox-1 2017-10-19 milestone Mar 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Accepted as Editorial Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-align-3 Current Work css-flexbox-1 Current Work css-grid-1 Tracked in DoC
Projects
None yet
Development

No branches or pull requests

3 participants