如果我有一个固定大小的容器,是否有一种方法可以在不影响子容器大小的情况下完全定位其子容器?
<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>
我不想为孩子设置显式尺寸,并且我希望其测量尺寸不受父母的限制。
答案 0 :(得分:0)
向右添加边距:-300px;到绝对元素(或任何大的负值)– Temani Afif