EDIT:
Per the comments, it was unexpected that the <div>
was ever centering - turned out to be a height thing, where the <div>
was taking up the parent's full height, but the custom element's children were not.
Also this isn't a duplicate but whatever
I have the following css:
.layout-main {
display: flex
flex-direction: column;
}
If I do the following:
<div class="layout-main">
<div> stuff goes here </div>
</div>
,
the "stuff" is centered vertically.
However, if I define a custom element, which results in:
<div class="layout-main">
<my-element>
<div> stuff goes here </div>
</my-element>
</div>
the "stuff" is not centered vertically.
If I explicitly set justify-content: center
on .layout-main
, problem solved.
If I set display: contents
on my-element
, problem also solved.
Saw this that seemed related / docs on contents
Why is the custom element not centered vertically the way a div is when inside a display: flex; justify-content: center
parent?