What is the default SVG unit in CSS?

点点圈 提交于 2020-01-11 13:23:29

问题


I would like to convert a transform SVG attribute into a CSS transform. Here it is:

<g transform="translate(11.225 164)"/>

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.


回答1:


The default (user) unit is px.

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".

Per the SVG specification



来源:https://stackoverflow.com/questions/45439133/what-is-the-default-svg-unit-in-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!