bootstrap center 3 col-md-3 divs

后端 未结 5 1177
既然无缘
既然无缘 2021-02-19 21:27

I have a wrapper like so:

and inside this wrapper I have 3 col-md-3 divs:

5条回答
  •  孤城傲影
    2021-02-19 22:02

    Centering floating (moreover responsive) elements like the bootstrap columns requires some work with the margins, like yuyokk suggested.

    Or you can unfloat the elements and use inline-block :

    .community-images {
      text-align: center;
    }
    
    .col-md-3 {
      float: none;
      display: inline-block;
      text-align: left; //reset the text alignement to left
    }
    

    Works everywhere, including IE8.

提交回复
热议问题