gpt4 book ai didi

html - 气泡 - 内容溢出

转载 作者:太空宇宙 更新时间:2023-11-03 18:12:16 25 4
gpt4 key购买 nike

我在 css3 中创建了一个气泡,但在某些浏览器(特别是 Windows Safari 5.1.7)中,我的跨度溢出了我的 anchor 标记,即使 1) 它是相对定位的并且 2) 具有静态宽度/高度和 overflow hidden 。在所有其他浏览器(Firefox、IE、Chrome)中,它看起来不错,但 anchor 链接(悬停)延伸到气泡外,达到 span 的宽度。因为它显示 block 。

我的问题是,为什么会溢出,我该如何解决?我认为使用相对位置和绝对元素可以将其放回原位,这不正确吗?

这是一个 JSFiddle of the problem在眼前。代码如下所示:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
body {background-color: #ccc;}
a {display: block; -moz-border-radius: 10em; -webkit-border-radius: 10em; border-radius: 10em; border: 5px solid #eee; width: 220px; height: 220px; overflow: hidden; position: relative; text-align: center; line-height: 24px; font-size: 20px; color: #fff; background-color: #fff;}
.content{display: block; position: absolute; bottom: 0px; background-color: #000; width: 100%; padding: 20px 0 30px;}
</style>
</head>
<body>
<a href="javascript:void(0);">
<span class="content">
Test<br />
Bubble
</span>
</a>
</body>

这是我在 chrome 上经常遇到的一个例子,如果我将鼠标悬停在绿色(填充)或蓝色(宽度)上,我的鼠标会进入一个指针,这不是链接应该在 overflow: hidden 的位置。 - 它在圆 Angular 之外。

enter image description here

最佳答案

所以这就是我想出来的..溢出隐藏不适用于链接,只是在视觉上隐藏它

http://jsfiddle.net/88UeR/

它唯一的视觉效果不是 block 级元素的剪裁

#a {
position:absolute;
border-radius:100px;
background-color:#72CEE0;
width:100px;
height:100px;
left:150px;
overflow:hidden;
}

所以如果你想完全隐藏它,你必须让内部元素不会溢出到父级之外,除了视觉上隐藏它之外的任何其他内容

关于html - 气泡 - 内容溢出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23478455/

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