Skip to content

[css-align] Mixing baseline self-alignment with random content alignments #3006

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
tabatkins opened this issue Aug 9, 2018 · 7 comments
Closed
Labels
Closed Rejected as Invalid Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-align-3 Current Work Needs Testcase (WPT)

Comments

@tabatkins
Copy link
Member

It doesn't seem to be clear what happens with, e.g., align-self: baseline; align-content: center;

@tabatkins
Copy link
Member Author

Wait, hmm, you have to do layout of the element before you can self-align anyway, because you need a size. So I guess there's nothing wrong with content-alignment affecting where the baseline sits when self-aligning.

@css-meeting-bot
Copy link
Member

The Working Group just discussed Mixing baseline self-alignment with random content alignments.

The full IRC log of that discussion <dael> Topic: Mixing baseline self-alignment with random content alignments
<dael> github: https://github.com//issues/3006
<dael> TabAtkins: I just commented in issue. I thinkg maybe jsut consfused. How can y ou mix abseline self alignment with any other. Baseline cares about your height. Seems odd how it interacted. now that I thought about it you have to do layout before self align so it's not a problem to do content alignment first and if you do center baseline is in center of element.
<dael> TabAtkins: So I think this i s close invalid.
<dael> florian: Is there no risk o f a dependency betweeen sizing and placing things? When you align on baseline can that cause things to grow? Or does that problem not exist?
<dael> TabAtkins: Good question. I should consider that futher.
<dael> florian: If that's okay, we're okay. If not we have a problem
<dael> fantasai: What you say makes sense if item itself has a size. You can align and then baseline align. Trickier thing what if it's sized as auto and that auto size is not purely shrinkwrapping around content.
<dael> fantasai: Where that box is positioned can change size of alignment container and then change alignment of content.
<dael> TabAtkins: Can we table for a full example? Example in issue isn't complex enough to show problem.
<dael> astearns: Okay, we'll come back with a more complex example
<dael> fantasai: And anyone with examples, let us know.

@frivoal
Copy link
Collaborator

frivoal commented Aug 15, 2018

Is this the problem we're talking about:
https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=6101

If align-self: baseline is supposed to align the baseline of the item with the first baseline of the grid, we'd have a problem, but I think it is supposed to align with the first baseline of the grid row, and that makes everything OK: first, layout the items, then baseline align them with each other, and figure out the height of the grid row from that, then now that you know its size, you can do align-content:center with no particular issue.

Or am I missing something?

@tabatkins
Copy link
Member Author

Missing something - the issue is align-content and align-self on the same element, so you're self-aligning (moving yourself within your container) according to a baseline that is being positioned by content-alignment (moving your contents within yourself).

@astearns astearns removed the Agenda+ label Aug 15, 2018
@frivoal
Copy link
Collaborator

frivoal commented Aug 16, 2018

aha! Makes more sense. So the issue would be this:

  1. Place your content within yourself -> this affects your layout/size
  2. Then, place yourself within your parent based on aligning baselines -> this affects your position, which may affect the layout/size of your parent in some cases.
  3. If your size was set in a way that depends on the size of the parent, then you need to relayout yourself, and that would cause a loop.

However, it seems this can only happen if:

  • the parent has a non definite size that is resolved based on layout of its content.
  • the item is sized in a way that depends on the parent's size even if it is non definite.

I don't think this situation actually exists.

Or am I still missing something?

@tabatkins
Copy link
Member Author

Right, I think you've got it now, and I also think this can't occur currently, but @fantasai was trying to explain a situation where this could occur on the call. I couldn't follow along her verbal explanation and asked for a written-out example here in this thread.

@tabatkins tabatkins added Closed Rejected as Invalid Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. Needs Testcase (WPT) labels Aug 24, 2018
@tabatkins
Copy link
Member Author

Closing, but flagging for a testcase to make sure this combo does indeed work as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Rejected as Invalid Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-align-3 Current Work Needs Testcase (WPT)
Projects
None yet
Development

No branches or pull requests

4 participants