Scale different width images to fit a row and maintain equal height

前端 未结 5 871
一向
一向 2021-02-03 10:09

I have three images which are all different widths, but each the same height.

I want these images to be in a responsive row so that the

5条回答
  •  再見小時候
    2021-02-03 10:32

    This could work - by using css table layout.

    jsFiddle

    body {
      margin: 0;
    }
    ul {
      list-style: none;
      padding: 0;
      margin: 0;
      display: table;
      border-collapse: collapse;
      width: 100%;
    }
    li {
      display: table-cell;
    }
    img {
      display: block;
      width: 100%;
      height: auto;
    }

提交回复
热议问题