首页 文章

需要图像以保持移动中的特定高度

提问于
浏览
0

我已经在WordPress主题(Jupiter)中使用Visual Composer在网站上进行了开发 . 在大多数页面上都有一个全宽行,图像的最大宽度为1600px . 客户端不喜欢随着浏览器窗口/移动设备的重新设置变小,照片缩小的程度 .

http://spiderman.ephronsystems.com/full-width-tester/

我在媒体查询中添加了这个CSS:

div.vc_single_image-wrapper.vc_box_border_grey {overflow:hidden;}
img.vc_single_image-img.attachment-full {height: 200px;width:auto;max-width:none;margin:0 auto;}

这似乎工作得很好,但我宁愿图像在浏览器窗口中居中 . 有人知道怎么修这个东西吗?我也可以用直接html替换VC编码 .

1 回答

  • 0

    img 上添加 margin-left: 50%;transform:translateX(-50%); ,如下所示

    @media (max-width: 736px) {
      .wpb_single_image img {
        height: 200px;
        width:auto;
        max-width:none;
        margin:0 auto;
        margin-left: 50%;
        transform:translateX(-50%);
      }
    }
    

    询问

相关问题