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
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

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

本文标签: