http://jsfiddle.net/J7psN/
<svg viewbox='0 0 80 80'>
<polygon id=button points='50,0 80,80 0,80'/>
<text x=40 y=50>HELLO</text>
</svg>
I have a polygon button with text on it, and I want the polygon to become brighter when you hover over it. The problem is that when you hover over the text, the polygon returns in the dark.
I would prefer to use mostly html / css, but I'm fine using javascript / jquery if I don't need another library.
I was hoping to do one of the following:
- Inserting a text element inside a polygon element, but this is not allowed. Cannot nest elements in svg :(
- Using CSS to target a polygon when text freezes, but you can't target your previous brother. CSS can focus on the next brother, but not the previous one :(
- Place the text element in front of the polygon, then use the following CSS member to target the polygon when the text freezes, but I cannot use the z-index for the text so that you cannot see the text then. No z-index support in svg :(
I thought it would be easy ... I ran into some annoying restrictions.
source
share