简体   繁体   English

:将{cursor:pointer}悬停在通过borderradius创建的圆上将使其成为指针,即使在圆外也是如此

[英]:hover { cursor: pointer } on circle created via borderradius will make it a pointer even outside the circle

I've created a circle button using border-radius. 我使用border-radius创建了一个圆形按钮。 My issue is that when using the following code: button:hover {cursor: pointer} the cursor will be a pointer even outside the circle ( but inside the "rectangular div"). 我的问题是当使用以下代码时: button:hover {cursor: pointer}光标将是一个指针,甚至在圆圈外(但在“矩形div”内)。 Im pretty sure I need javascript to solve this (althou I've included the CSS tag in case im wrong), but other than that Im blank, if anyone could Point me in the right direction, it'd be great! 我很确定我需要javascript来解决这个问题(我已经包含了CSS标签,以防我错了),但除此之外,我是空白的,如果有人能指出我正确的方向,它会很棒!

thanks. 谢谢。

You can use SVG for that. 你可以使用SVG。 SVG is cross browser capable. SVG具有跨浏览器功能。

<svg>
    <circle cx="40" cy="40" r="24"/>
</svg>

circle:hover{
    cursor: pointer;
    background: yellow;
}

DEMO: http://jsfiddle.net/DerekL/Jpnre/ 演示: http//jsfiddle.net/DerekL/Jpnre/
MDN: https://developer.mozilla.org/en/CSS/Getting_Started/SVG_graphics MDN: https//developer.mozilla.org/en/CSS/Getting_Started/SVG_graphics

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM