Css hover sometimes doesn't work on svg paths

前端 未结 3 783
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-06 04:08

I got a svg with paths, and i have css hover on them, but hover sometimes work, sometimes not.

What can be the problem?

3条回答
  •  攒了一身酷
    2020-12-06 04:46

    There's no fill so the interior does not catch mouse events by default and therefore hover doesn't react to that. Changing pointer-events to all will fix it in this case:

    path{
        fill:none;
        stroke:black;
        pointer-events:all;
    }
    

提交回复
热议问题