I'm having difficulty achieving vertical centering for an image in a react-slick carousel implementation. The issue can be seen here.
https://codesandbox.io/s/react-slick-playground-o7dhn
Here are the problems identified:
Images are not centered:
- The Flexbox property does not work as intended (the red div, set as a flexbox with
)justify-content: center; align-items: center;
margin:auto
only works for horizontal alignment, which should not be necessary when using Flexbox.- Unable to eliminate top margin despite setting
padding:0px
on the div andmargin-top:0px
on the image. Consequently, any image exceeding 400px in height is shifted and cut off due to the fixed height of the div being 400px.
https://i.stack.imgur.com/Vtzrg.jpg
Any suggestions on how to resolve this issue would be greatly appreciated.