我有以下代码:
<div class="details"><button className="details-btn"></button>
<div>
<p className="title">Some content
</p>
</div>
具有以下样式
.details {
display: flex
}
button::before {
content: url('data:image/svg+xml; utf8, <svg width="13" height="14" viewBox="0 0 13 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.38128 4.61866L5.61872 3.38123L9.23743 6.99994L5.61872 10.6187L4.38128 9.38123L6.76256 6.99994L4.38128 4.61866Z" fill="black"/></svg>')
}
我想要居中的图像来自::before
与段落.问题是,即使我的SVG的高度是14,得到的::before
元素的高度是15
.我为什么以及如何解决这个问题(我必须使用::before
)