[css-align] Clarify how justify-self
affects automatic size of block-level box
#12102
Labels
justify-self
affects automatic size of block-level box
#12102
I'm quite puzzled by other implementers and even spec editors interpreting the spec in ways that seem weird to me, so let's clarify the behavior.
How does
justify-self
affect the automatic size of a block-level box?I think https://drafts.csswg.org/css-align/#justify-self-property is clear:
So the automatic size only stretches with
justify-self: stretch
(orauto
/normal
that behave asstretch
).As discussed in #11463, this behavior differs from
<center>
andalign=""
. But it's consistent with flex items, grid items, and abspos, so I think it's the reasonable thing to do.It's also how it works in Blink and Servo#36595 (AFAIK the only implementations).
However, @fantasai interpreted the spec as only using
fit-content
in over-constrained cases.How do
auto
margins affect the above?In this example, both
#a
and#b
should be sized asfit-content
as per the above. Then,#b
hasauto
margins, so it should appear centered instead of aligned to the right.However, presumably because of
Blink interprets that
auto
margins completely nullifyjustify-self: right
, and thus#b
stretches as forjustify-self: normal
.I think that's very unexpected, my interpretation of the note is that
margin: auto
will center even withjustify-self: right
, but that it doesn't preventjustify-self: right
from affecting the size.The text was updated successfully, but these errors were encountered: