gpt4 book ai didi

javascript - CSS/JavaScript - 元素外的内容溢出 :hidden

转载 作者:数据小太阳 更新时间:2023-10-29 04:43:12 26 4
gpt4 key购买 nike

我有一个容器 div 元素,上面有 overflow:hidden。不幸的是,由于网站的制作方式,此属性是必需的。

在这个 div 中是所有网站内容,包括一些工具提示。当您将鼠标悬停在链接或其他内容上时,这些工具提示将通过 jQuery 显示。

问题是,由于上面的溢出,这些工具提示中的一些将显示部分隐藏,因为它们位于容器 div 之外......

有什么方法可以显示此容器内的特定元素,即使它超出了容器的边界?也许是 JavaScript 解决方案?

html 看起来像这样:

<div style="overflow:hidden; position:relative;">

the main content

<div style="position:absolute;left:-100px;top:-50px;"> the tooltip thing </div>

</div>

最佳答案

试试这个:

<div style="position:relative;">    
<div style="overflow:hidden; position: relative; width: {any}; height: {any};">the main content<div>
<div style="position:absolute;left:-100px;top:-50px;"> the tooltip thing </div>
</div>

只需将您的主要内容放在主 div 内的另一个 div 中,并提供提供的 css 以在溢出时隐藏内容...

关于javascript - CSS/JavaScript - 元素外的内容溢出 :hidden,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3590928/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com