今天我遇到了一些代码,作者将长度声明为 <numeric value>%<numeric value>
CSS:width: 100%25;
HTML/SVG:width="100%25"
我编写 CSS 已有多年,但从未见过这样声明的长度。它似乎适用于 HTML、SVG 和 CSS。
它是某种形式的速记吗?这是什么意思?我尝试过寻找答案,但该主题的性质使我很难找到答案。
<svg viewBox='0 0 900 900' xmlns='http://www.w3.org/2000/svg'>
<foreignObject width='100%25' height='100%25'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<style>
.c{
display:flex;
align-items:center;
justify-content:center;
margin:0;
width:100%25;
height:900px
}
.b{
width:33.33%25;
height:33.33%25;
background:red
}
</style>
<div class='c'>
<div class='b'/>
</div>
</div>
</foreignObject>
</svg>
最佳答案
您正在查看的代码包含百分比编码的 %
字符(迄今为止)仍未解码。
如果您进行百分比编码:
%
你得到:
%25
进一步阅读:
关于html - CSS 长度中的 <number>%<number> 是什么意思,例如 100%25,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66625313/