CSS中默认的SVG单位是什么? [英] What is the default SVG unit in CSS?
本文介绍了CSS中默认的SVG单位是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将transform
SVG属性转换为CSS transform
.在这里:
I would like to convert a transform
SVG attribute into a CSS transform
. Here it is:
<g transform="translate(11.225 164)"/>
但是CSS要求我指定单位.指定的正确单位是什么?由于它应该是一个库,因此我不知道<svg>
的width
,height
或viewport
.因此,我无法计算px
左右.
But CSS requires me to specify units. What is the correct unit to specify? Since it's supposed to be a library, I don't know the width
, height
or viewport
of the <svg>
. Thus I can't compute the px
or so.
推荐答案
默认(用户)单位是px.
The default (user) unit is px.
一个px单位被定义为等于一个用户单位.因此,"5px"的长度与"5"的长度相同.
One px unit is defined to be equal to one user unit. Thus, a length of "5px" is the same as a length of "5".
根据 SVG规范
这篇关于CSS中默认的SVG单位是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文