Margin: 0 auto is not centering my image

后端 未结 5 1303
庸人自扰
庸人自扰 2021-02-14 12:25

I\'m very new to all of this and am trying to build this website, but the main image on the page is not centering. I\'ve tried all sorts of centering things but they don\'t work

5条回答
  •  不思量自难忘°
    2021-02-14 13:16

    i know this is an old post, but wanted to share how i solved the same problem.

    My image was inheriting a float:left from a parent class. By setting float:none I was able to make margin:0 auto and display: block work properly. Hope it may help someone in the future.

提交回复
热议问题