我有一个场景,需要可点击的 .svg 文件对象,该对象位于锚标签和 div 下方。
我有解决方案,可以将
我有解决方案,可以将
display:inline-block
添加到 div (.svg-wrapper
) 或锚标签。然而,由于某些 CSS 功能,我需要在锚标签上以及在 div 上使用Display:contents
。
.component-content{
display: flex;
overflow: hidden;
}
a{
display: contents;
}
.svg-wrapper{
display: contents;
}
.svg-container{
height: auto;
align-self: start;
padding: 0 19px 0 0;
max-width: 50%;
pointer-events: none;
}
<div class="component-content">
<a href="http://google">
<div class="svg-wrapper">
<object class="svg-container" type="image/svg+xml" data="https://beta.designforventures.co/Free-Animated-SVG-Icons/warehouse/youtube-icon-dark-grey.svg">
<img src="https://beta.designforventures.co/Free-Animated-SVG-Icons/warehouse/youtube-icon-dark-grey.svg">
</object>
</div>
</a>
</div>