Closed rtfeldman closed 6 years ago
According to the documentation passing center
to a singular element like el
will affect the alignment of the individual element, not the child of the element. So I think this is the expected behavior.
To clarify: You get the element centered, if you remove the width
attribute, since the el
element will have space to "center" in.
This issue inspired an overhaul for how alignment works under the hood for v5
...so, that's awesome! 😄
The big picture of what I'm trying to do
I'm making a thing that looks like this:
The first thing I tried to get
whee!
centered in the middle led to a surprising result.What I did
I put this in the middle of a
row
. The element to the left ("Title" in the screenshot) hadalignLeft
and the element to the right ("rtfeldman" in the screenshot) hadalignRight
.All three had
width (fillPosition 1)
. My intention was to center this middle one withcenter
.What I Expected To Happen
"whee!" would get centered, like in the screenshot. (The screenshot shows what I was going for, not what this code actually did.)
What Actually Happened
"whee!" was left-aligned within its container element like so:
When I swapped
el
forrow
, with no other changes, the layout worked as I'd hoped:This suggests passing
center
toel
compiles but has no effect. I would have expected that either:center
would center things withel
the same way it does withrow
center
toel
would not type-check (I suspect this is achievable!)Versions