SVG图标不可在div元素中单击。 Div是可单击的。这是我的CSS:
&__icon {
position: absolute;
top: 0.1em;
right: 50%;
transform: translateX(50%);
opacity: 0.5;
width: 2.5em;
height: 2.5em;
svg {
width: 100%;
height: 100%;
pointer-events: none;
}
}
找到解决方案,根据https://stackoverflow.com/a/50925509/13568935
Div重叠SVG。在CSS中将z-index:-1设置为DIV或将SVG元素设置为z-index:2。