Re: [csswg-drafts] [css-align] Clarify how `justify-self` affects automatic size of block-level box (#12102)

The CSS Working Group just discussed ``[css-align] Clarify how `justify-self` affects automatic size of block-level box``, and agreed to the following:

* ``RESOLVED: Values of `justify-self` other than normal or stretch treat the automatic size as fit-content, just like in flex/grid``
* `RESOLVED: auto margins do not prevent justify-self from imposing fit-content`

<details><summary>The full IRC log of that discussion</summary>
&lt;emilio> oriol: two implementations of justify-self on block boxes (blink and servo). We interpreted some things that the spec says in different ways<br>
&lt;emilio> ... some things we agree on fantasai disagreed on<br>
&lt;emilio> ... want to clarify this<br>
&lt;emilio> ... two questions:<br>
&lt;emilio> ... first could be the effect of `justify-self` on the auto size of a block level box<br>
&lt;emilio> ... spec says that values other than stretch makes auto size fit-content<br>
&lt;emilio> ... so it applies to grid/flex items and block level items<br>
&lt;emilio> ... both blink and servo did this<br>
&lt;emilio> ... fantasai was interpreting it as this property doesn't affect block level sizing, only in over-constrained cases<br>
&lt;iank_> +1 to Oriol - it makes it more consistent w/ grid/flex<br>
&lt;emilio> ... I kinda prefer the fit-content behavior unconditional<br>
&lt;emilio> ... allows to explain tables<br>
&lt;emilio> ... could be explained as `justify-self: normal` on keywords is `start` rather than `stretch`<br>
&lt;emilio> ... on the other hand means diverging from `&lt;center>` and html `align` attributes since those don't prevent stretching<br>
&lt;emilio> ... I prefer treating block-level boxes as other boxes<br>
&lt;emilio> ... but if fantasai wants to argue for an exception...<br>
&lt;astearns> ack fantasai<br>
&lt;iank_> q+<br>
&lt;emilio> fantasai: this also plays into the related issue about the effect of these properties when anon boxes are present<br>
&lt;emilio> ... anon boxes always stretch<br>
&lt;emilio> ... so there's an issue there where if you take the position that this affects fit-content you get inconsistent behavior if you have anon boxes<br>
&lt;emilio> ... I initially thought that this was fixing the alignment of stuff given how long block layout has existed<br>
&lt;emilio> ... guess we could go either way<br>
&lt;astearns> ack iank_<br>
&lt;emilio> iank_: IMO this makes the feature useful by default<br>
&lt;emilio> ... so kinda prefer how servo and blink interpret it<br>
&lt;emilio> q+<br>
&lt;astearns> ack emilio<br>
&lt;fantasai> emilio: Don't disagree, but was curious about the anonymous box situation<br>
&lt;fantasai> emilio: justify wouldn't apply to the anonymous box, right?<br>
&lt;fantasai> iank_: Concern for top-level anonymous boxes that are generated<br>
&lt;fantasai> iank_: consider our previous behavior a bug, so changed so that anonymous boxes ignore justify and always stretch, but we can talk about that issue separately<br>
&lt;fantasai> emilio: Makes sense to be consistent with block (???) to not introduce other issues<br>
&lt;fantasai> iank_: What do you mean?<br>
&lt;fantasai> emilio: If it doesn't do weird things if you have an anonymous block inside.<br>
&lt;fantasai> emilio: If that's ok, then making it work by default makes sense.<br>
&lt;fantasai> astearns: Do we have consensus? what's the resolution?<br>
&lt;fantasai> oriol: Values other than normal or stretch treat the automatic size as fit-content, just like in flex/grid<br>
&lt;fantasai> astearns: Does everyone agree?<br>
&lt;fantasai> fantasai: I'm ok with it.<br>
&lt;emilio> fantasai: we should ack that this makes justify-self not work for html centering stuff<br>
&lt;TabAtkins> yeah, we've abandoned doing &lt;center> with this now<br>
&lt;emilio> PROPOSED: Values of `justify-self` other than normal or stretch treat the automatic size as fit-content, just like in flex/grid<br>
&lt;emilio> RESOLVED: Values of `justify-self` other than normal or stretch treat the automatic size as fit-content, just like in flex/grid<br>
&lt;emilio> oriol: there's another thing about how auto margins behave with this<br>
&lt;emilio> ... in servo we have different interpretations<br>
&lt;emilio> ... there's an example in the issue. If you set `justify-self: right` then the size will be `fit-content`, however if then you add auto margins, then these prevent `justify-self` from forcing fit-content<br>
&lt;emilio> ... in servo justify-self still prevents the stretching even with auto margins, and I think that makes more sense<br>
&lt;fantasai> +1<br>
&lt;oriol> https://github.com/w3c/csswg-drafts/issues/12102<br>
&lt;emilio> iank_: yeah basically, do auto margins disable justify-self or just the alignment part of it<br>
&lt;fantasai> If stretching is disabled for zero margins, then it should definitely be disabled for auto margins<br>
&lt;emilio> +1<br>
&lt;emilio> fantasai: this goes back to the first issue, where alignment is applied after margins<br>
&lt;fantasai> which are applied after sizing decisions<br>
&lt;emilio> oriol: right in this case the size of the margin box fills the container<br>
&lt;emilio> ... so you don't see the effect but it's not "not working"<br>
&lt;emilio> fantasai: if the box is larger than the container the auto margins will not absorb that space<br>
&lt;emilio> ... not sure we want the alignment to take effect in that case<br>
&lt;emilio> ... if you have auto margins you were expecting a particular alignment<br>
&lt;emilio> ... or do you just start-align it<br>
&lt;emilio> oriol: I think if you have unsafe alignment then why not<br>
&lt;emilio> ... but yeah, not sure<br>
&lt;emilio> iank_: I think auto margins are safe by default, so I think the defaults are actually the same<br>
&lt;emilio> fantasai: right but in this case the margin can't absorb the negative space<br>
&lt;emilio> iank_: but by default it's safe alignment so the default should be fine?<br>
&lt;emilio> fantasai: not sure it falls out of the definitions<br>
&lt;emilio> iank_: to be clear I'm fine changing blink here<br>
&lt;fantasai> I think CSS2.1 is written in a way that this wouldn't fall out.<br>
&lt;emilio> astearns: does the previous resolution apply here?<br>
&lt;emilio> oriol: probably should be a separate one<br>
&lt;emilio> ... the question that fantasai raised could be for a separate issue. We can resolve for the non-overflowing cases<br>
&lt;emilio> PROPOSED: alignment values different than stretch cause sizing to be fit-content, regardless of auto margins<br>
&lt;fantasai> PROPOSED: auto margins do not prevent justify-self from imposing fit-content<br>
&lt;fantasai> RESOLVED: auto margins do not prevent justify-self from imposing fit-content<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12102#issuecomment-2880917326 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 14 May 2025 16:53:44 UTC