css – 可以定位:绝对元素以某种方式戳出溢出:隐藏的容器?

我怀疑答案是非常肯定的,但鉴于以下html和css,是否有一些调整(没有编辑html)我可以做到绝对定位“东西”出现,同时保持隐藏其他溢出内容.

<div class="wrap">
<p>Loads of words. Loads of words. Loads of words. Loads of words. Loads of words. Loads of words. Loads of words. Loads of words. Loads of words. Loads of words. Loads of words. Loads of words. Loads of words. Loads of words. Loads of words. Loads of words. </p>
   <div class="thing">thing</div>
</div>

.wrap {
  width: 100px;
  height: 100px; 
  overflow:hidden;
  position:relative;
}

.thing {
   position:absolute;
   top: -3px;
   right: -10px;
}

最佳答案 不,您必须将高度/宽度设置为内容而不是.wrap元素本身.解决方案将是.thing旁边的内部div.

点赞