Bootstrap columns not aligning correctly

前端 未结 4 1455
小鲜肉
小鲜肉 2020-12-10 03:38

I\'ve built a layout using Bootstrap 3, and I have the following problem: I have a news section that is set to display a total of 9 news items, 3 on each row, summing 3 rows

4条回答
  •  一向
    一向 (楼主)
    2020-12-10 04:06

    Also late suggestion - same problem here with 2 columns containing images all the same height. Because of the way the divs are generated, I couldn't add a clearfix to individual divs and when added by targeting the odd divs via css, it didn't work. So the simplest solution for me was to add padding to the odd divs:

    .col-md-6:nth-child(odd){padding-bottom:15px;}
    

    Or alternatively give the odd divs a height slightly more than the image height:

     .col-md-6:nth-child(odd){height:310px;}
    

提交回复
热议问题