Image centering in div
This question already has an answer here:
Two simple options:
margin:0 auto
to the element that you want to be centered display: flex; justify-content: center; align-items: center;
display: flex; justify-content: center; align-items: center;
to the parent/wrapper element If the first one doesn't work, the second option definitely should. How it works:
justify-content
defines where flex items will align according to the main axis (horizontally in our case).
align-items
does the same with the axis perpendicular to the main one (vertically in our case).
上一篇: 将图像集中在一个部分中
下一篇: 图像以div为中心