【发布时间】:2021-12-31 20:47:12
【问题描述】:
我想将 SVG 转换为 HTML。 Svg 文本有一个转换值。将这些值应用于 HTML 元素不会产生相同的结果:SVG 在它们之间有更多空间,而不是在 HTML 中。我想不出为什么。 这是一个示例代码: SVG =>
<svg
version="1.1"
id="Calque_1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px"
y="0px"
viewBox="0 0 512 512"
enable-background="new 0 0 512 512"
xml:space="preserve"
>
<rect id="background" fill="#E0FFCC" width="512" height="512" />
<text
id="company"
transform="matrix(1 0 0 1 124.9124 378.1289)"
font-family="'Rockwell-Regular'"
font-size="48px"
>
My comfort
</text>
<text
id="headline"
transform="matrix(1 0 0 1 163.2376 439.8711)"
font-family="'Rockwell-Regular'"
font-size="21px"
>
fuzzboxes jazzbos
</text>
</svg>
HTML =>
<div
style="
position: relative;
background-color: #e0ffcc;
width: 512px;
height: 512px;
"
>
<div
style="
position: absolute;
font-family: 'Rockwell-Regular';
font-size: 48px;
transform-origin: top left;
transform: matrix(1, 0, 0, 1, 124.9124, 378.1289);
"
font-size=""
>
My comfort
</div>
<div
style="
position: absolute;
font-family: 'Rockwell-Regular';
font-size: 21px;
transform-origin: top left;
transform: matrix(1, 0, 0, 1, 163.2376, 439.8711);
"
font-size=""
>
fuzzboxes jazzbos
</div>
</div>
【问题讨论】:
-
请将代码贴在这里,不要分享代码链接。
标签: html css svg css-transforms