I'm attempting to vertically center an <amp-img>
within a div.
<div class="outer" style="height: 100vh">
<amp-img class="inner" layout="responsive"></amp-img>
</div>
I have tried various methods so far, but none seem to be working:
First Attempt
.outer {
display: flex;
justify-content: center;
align-items: center;
}
In this case, the image disappears.
Second Attempt
.outer {
line-height: 100vh
}
.inner {
display: inline-block;
vertical-align: center;
}
Here, the image's size becomes 0 x 0
and it disappears as well.
And More
Other approaches also lead to the disappearance of the image or do not behave as expected.
Is there any way to successfully center the <amp-img>
vertically?