【发布时间】:2014-02-22 20:21:55
【问题描述】:
我没有找到任何关于此的信息。可能是因为我的方法不正确。
我的图像绝对位于使用全窗口宽度的 div 下。
我正在使用margin-left: 30%,因此图像始终位于距左边框 30% 的位置。
其他一切都设置为响应式图像处理..
我得到了正确的代码,如果浏览器窗口被调整大小,它会像我想要的那样缩放。 但由于图像未居中,缩放“来不及”,因此右侧部分将隐藏在视图之外。
我可以通过“更早”开始缩放来解决这个问题吗? 或者使用不同于 margin-left: 30% 或 left: 30% 的东西?
请看这里:JsFiddle - Image out of view when resizing window
img.aaa
{
position: absolute;
max-width: 85%;
max-height: 85%;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin-top: auto;
margin-right: auto;
margin-bottom: auto;
margin-left: 30%;
}
【问题讨论】:
标签: css image-scaling window-resize