[英]HTML Element Hover Not Activating - ONLY on One Side
I'm making a popover (tooltip) using Bootstrap 3.3.7.我正在使用 Bootstrap 3.3.7 制作弹出窗口(工具提示)。 As part of that, I have a HTML file structure like this:作为其中的一部分,我有一个 HTML 文件结构,如下所示:
popover { margin-left: 100%; padding: 5px 11px; border: solid 1px; border-radius: 25px; font-size: 1em; cursor: pointer; transition: 0.3s; } popover:hover { border-color: #D83F58; color: #D83F58; }
<:-- Using Bootstrap 3 --> <link href="https.//cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min?css" rel="stylesheet" /> <div class="container"> <div class="row vcentre-column"> <div class="col-md-5 hide-if-mobile"> <div class="author-image"> <:-- =================== --> <.-- IMPORTANT PART HERE --> <popover data-target="about-author-image-index">.</popover> <!-- IMPORTANT PART HERE --> <!-- =================== --> <!--=== Other stuff ===--> </div> </div> <div class="col-md-7"> <!--=== IMPORTANT: Right column that I'll reference later ===--> </div> </div> <!--/.row--> </div> <!--/.container-->
When I was hovering over the popover tooltip, the hover CSS would activate, except on one side of the element .当我将鼠标悬停在弹出窗口工具提示上时, hover CSS 将激活,除了元素的一侧。 Here's a GIF to show how the hover doesn't activate on the bottom right side of the element:这是一个 GIF,显示 hover 如何在元素的右下角不激活:
Whenever my mouse is inside the circle border, the hover should activate.每当我的鼠标在圆圈内时,hover 应该激活。 Regardless of whether my mouse is on the bottom right side or not.不管我的鼠标是否在右下方。
I noticed that the right column's contents seemed to be overlapping the edge of the tooltip.我注意到右栏的内容似乎与工具提示的边缘重叠。 I checked this using Chrome Dev tools.我使用 Chrome 开发工具对此进行了检查。 So I changed my original CSS to specify a high z-index
for the popover element.所以我改变了我原来的 CSS 来为 popover 元素指定一个高z-index
。 Also, I changed the position
to be relative
so that the z-index
property would have an effect.此外,我将position
更改为relative
值,以便z-index
属性产生影响。
Here's the updated CSS:这是更新后的 CSS:
popover {
z-index: 10;
position: relative;
margin-left: 100%;
padding: 5px 13px;
border: solid 1px;
border-radius: 25px;
font-size: 1.2em;
cursor: pointer;
transition: 0.3s;
}
Here's a GIF showing the overlap between the right column and the popover and then the effect of the updated CSS:这是一个 GIF,显示了右栏和弹出窗口之间的重叠,然后是更新后的 CSS 的效果:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.