Clear Rows When Doing Multi-responsive Columns - Bootstrap

后端 未结 10 1142
不知归路
不知归路 2020-12-04 10:32

That title might not be very accurate but here is the situation:

\"The

10条回答
  •  感动是毒
    2020-12-04 11:00

    The reason why your layout is breaking is due to the dynamic height of the images being presented. The fix is simple though, just constrain the height of the images. For example

    HTML

    
    

    CSS

    .file-block {
      border: 1px solid #ccc;
      border-radius: 10px;
      margin: 20px 0px;
      text-align: center;
    }
    
    .file-thumbnail {
      display: block;
      padding: 4px;
      margin-bottom: 20px;
      line-height: 1.42857143;
      height: 180px;
      font: 0/0 a;         /* remove the gap between inline(-block) elements */
    }
    
    .file-thumbnail:before {
      content: ' ';
      display: inline-block;
      vertical-align: middle;  /* vertical alignment of the inline element */
      height: 100%;
    }
    
    .file-thumbnail img {
      display: inline-block;
      margin: 0 auto;
      max-width: 150px;
      max-height: 180px;
      vertical-align: middle;
    }
    

    Check out the CodePen to see it in action. Hope this helps.

提交回复
热议问题