如果我有一个固定大小的容器,有没有一种方法绝对地定位它的子容器,使容器的大小不影响子容器的大小?
<div style="background: indigo; width: 300px; height: 200px; position: relative;">
Fixed size container
<div style="background: darkblue; display: inline-block; position: absolute; left: 200px; top: 0px;">
I'd like this child to overhang, not wrap.
</div>
</div>
我不想在子级上设置显式的大小,我希望它的测量大小不受父级的限制。
https://jsfiddle.net/nbilyk/2vzb1e4t/latest/
增加边距-右:-300px; 到绝对元素(或任何大的负值)-Temani Afif