http://alexandermasters.com/flora/2015/10/05/corey-boyce/
尝试将图像在其各自的容器内水平居中。
似乎无法隔离要应用的正确元素
display: block;
margin-left: auto;
margin-right: auto;
从图像开始逐步完成代码,但无济于事。
最佳答案
试试这个 CSS 代码
.gallery-item {float:none; margin:0 auto; text-align:center}
定位 IMG 标签不起作用,因为它嵌套在另一个元素中,因此您必须将 img 的父元素居中。
当有 float 时,margin:auto将无法正常工作
关于CSS:图像居中[问题],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34972725/