悬停在 div 的半径之外

标签 hover css

我在将 border-radius 与悬停状态结合使用时遇到问题。 悬停状态只应在光标位于圆圈顶部时发生。所以不是当它在 div 的 Angular 落时。

示例:http://tinker.io/e059c

这似乎是不可能的,所以欢迎提供有用的解决方法。

最佳答案

根据你所说的,

The hover state only should happen when the cursor is on top of the circle. So not when it's in the div's corner.

这是 WORKING SOLUTION .

HTML:

<div class='test'></div>
<div class="center"></div>

CSS:

.test{
    height:100px;
     width:100px;
    background-color:red;
    border-radius:100px;
    -webkit-border-radius: 100px;  
    -moz-border-radius: 100px;  
    position:absolute;

}

.test:hover{
    background-color:blue;
}

.center{height:90px;
     width:90px;
    background-color:red;
    border-radius:100px;
    -webkit-border-radius: 100px;  
    -moz-border-radius: 100px;  
    position:absolute;
    z-index:99;
    top:5px;
    left:5px;
}

希望这就是您要找的。希望这会有所帮助。

关于悬停在 div 的半径之外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17230990/

相关文章:

html - CSS 链接 :hover style only applies to the first instance even with using class

css - 悬停链接后,CSS 声明不起作用

css - hover li.class 时如何显示div.class?

javascript - 单击时用颜色从中心填充圆形 Div

css - Z索引不适用于伪

css - 无法识别对 _settings 的更改

objective-c - NSButtonCell 悬停图像,点击透明背景?

javascript - 我如何修复 :hover on iPhone if there is no <a> element?

css - 如何在导航中定位文本 "div."

html页面的html和css定位 "elements"