javascript - :hover { cursor: pointer } on circle created via borderradius will make it a pointer even outside the circle - Stac

I've created a circle button using border-radius. My issue is that when using the following code:

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
Add a ment  | 

1 Answer 1

Reset to default 3

You 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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745650254a4638219.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信