IE and Edge fix for object-fit: cover;

前端 未结 6 1624
清歌不尽
清歌不尽 2020-11-27 05:54

I\'m using object-fit: cover; in my CSS for images on a specific page, because they need to stick on the same height. It works great in most browse

6条回答
  •  清歌不尽
    2020-11-27 06:21

    Here is the only CSS solution to fix this. Use the below css.

    .row-fluid {
      display: table;
    }
    
    .row-fluid .span6 {
      display: table-cell;
      vertical-align: top;
    }
    
    .vc_single_image-wrapper {
      position: relative;
    }
    
    .vc_single_image-wrapper .image-wrapper {
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      right: 0;
      background-size: cover;
      background-repeat: no-repeat;
      background-position: 50% 50%;
    }
    

    HTML from the OP:

    try this, it should work. also remove float from .row-fluid .span6

提交回复
热议问题