我正在尝试在一个段落中内联SVG标签功能。
该标签的功能与我希望在段落中内联的一样,而SVG声明了自己的行。
发生这种情况:
我的文字在这里
[SVG图片]
我的文字在这里继续
这就是我想要的:
我的文字在这里[SVG图片]我的文字在这里继续。
此JSFiddle显示了问题:https://jsfiddle.net/aorsten/pq6zsmh0/9/
<p class="text-justify">
I am writing a text here, and letting it go on for a few lines. <img src="https://i.postimg.cc/gncBZvLn/block2.png" alt="hi"> I am writing a text here, and letting it go on for a few lines. I am writing a text here, and letting it go on for a few lines.
I am writing a text here, and letting it go on for a few lines.
<a href="#">
<svg viewBox="0 0 314325 314325" preserveAspectRatio="xMidYMid meet" class="svg">
<g transform="translate(0 0)scale(0.16019417475728157 0.16019417475728157)rotate(0 157162.5 157162.5)translate(0 0)">
<g transform="translate(0 0)rotate(0 981075 981075)">
<image href="https://i.postimg.cc/hJmCBs63/groupgrid.png" width="1962150" height="1962150" preserveAspectRatio="none">
</image>
</g>
<g transform="translate(1133475 990600)rotate(0 73025 73025)">
<image href="https://i.postimg.cc/gncBZvLn/block2.png" width="146050" height="146050" preserveAspectRatio="none">
</image>
</g>
</g>
</svg>
</a> I am writing a text here, and letting it go on for a few lines. I am writing a text here, and letting it go on for a few lines. I am writing a text here, and letting it go on for a few lines.
</p>
.text-justify {
text-align: justify !important;
}
img {
max-height: 1.5em;
}
.svg {
max-height: 1.5em;
display: inline-block;
position: relative;
vertical-align: bottom;
}
答案 0 :(得分:1)
对SVG使用width
选项。
.svg {
width: 1.5em;
vertical-align: middle
}
答案 1 :(得分:0)
.text-justify {
text-align: justify!important;
}
img {
max-height: 1.5em;
}
.svg {
max-height: 1.5em;
display: inline-block;
position: relative;
vertical-align: bottom;
}
<p class="text-justify">
I am writing a text here, and letting it go on for a few lines. <img src="https://i.postimg.cc/gncBZvLn/block2.png" alt="hi"> I am writing a text here, and letting it go on for a few lines. I am writing a text here, and letting it go on for a few lines. I am writing a text here, and letting it go on for a few lines.
<a href="#">
<svg width="24" height="24" viewBox="0 0 314325 314325" preserveAspectRatio="xMidYMid meet" class="svg">
<g transform="translate(0 0)scale(0.16019417475728157 0.16019417475728157)rotate(0 157162.5 157162.5)translate(0 0)">
<g transform="translate(0 0)rotate(0 981075 981075)">
<image href="https://i.postimg.cc/hJmCBs63/groupgrid.png" width="1962150" height="1962150" preserveAspectRatio="none">
</image>
</g>
<g transform="translate(1133475 990600)rotate(0 73025 73025)">
<image href="https://i.postimg.cc/gncBZvLn/block2.png" width="146050" height="146050" preserveAspectRatio="none">
</image>
</g>
</g>
</svg>
</a>
I am writing a text here, and letting it go on for a few lines. I am writing a text here, and letting it go on for a few lines. I am writing a text here, and letting it go on for a few lines.
</p>