我有以下结构
<div class="container">
<div class="wrapper">
<img class="image">
<div class="child-2"></div>
<div class="child-3"></div>
</div>
</div>
container具有固定的高度和宽度。
它是响应式设计,因此图像将缩放以适应container其中max-height并max-width设置为 100%。
child-1并且child-2需要定位在图像顶部的特定位置。为了实现这一点,我也做wrapper了100%max-height和max-width100%,所以它把自己包裹在图像周围。然后我可以将child-1和 2 相对于wrapper.
在 WebKit 中,它工作得很好,但是在 FF 和 Opera 中,它没有。他们根本不尊重最大值。