admin管理员组文章数量:1026989
I've created a circle button using 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"). 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!
thanks.
I've created a circle button using 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"). 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!
thanks.
Share Improve this question edited Apr 14, 2012 at 0:41 Ruan Mendes 92.4k31 gold badges159 silver badges222 bronze badges asked Apr 14, 2012 at 0:34 BrianPBrianP 771 silver badge6 bronze badges 1- 1 this is how the browser renders the element... the rounded edges are part of the element - so I don't think that this can be done (unless you use some html 5 canvas element on top or something - but this is very messy... – Yaron U. Commented Apr 14, 2012 at 0:45
1 Answer
Reset to default 3You can use SVG for that. SVG is cross browser capable.
<svg>
<circle cx="40" cy="40" r="24"/>
</svg>
circle:hover{
cursor: pointer;
background: yellow;
}
DEMO: http://jsfiddle/DerekL/Jpnre/
MDN: https://developer.mozilla/en/CSS/Getting_Started/SVG_graphics
I've created a circle button using 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"). 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!
thanks.
I've created a circle button using 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"). 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!
thanks.
Share Improve this question edited Apr 14, 2012 at 0:41 Ruan Mendes 92.4k31 gold badges159 silver badges222 bronze badges asked Apr 14, 2012 at 0:34 BrianPBrianP 771 silver badge6 bronze badges 1- 1 this is how the browser renders the element... the rounded edges are part of the element - so I don't think that this can be done (unless you use some html 5 canvas element on top or something - but this is very messy... – Yaron U. Commented Apr 14, 2012 at 0:45
1 Answer
Reset to default 3You can use SVG for that. SVG is cross browser capable.
<svg>
<circle cx="40" cy="40" r="24"/>
</svg>
circle:hover{
cursor: pointer;
background: yellow;
}
DEMO: http://jsfiddle/DerekL/Jpnre/
MDN: https://developer.mozilla/en/CSS/Getting_Started/SVG_graphics
本文标签:
版权声明:本文标题:javascript - :hover { cursor: pointer } on circle created via borderradius will make it a pointer even outside the circle - Stac 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745650253a2161273.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论