Closed airen closed 5 years ago
@airen 你好,看了你的文章的。如果过滤第三方库不进行转换?
And, if I have a img tag like this:
<img src="url" width="100" />
I hope it can be converted to:
<img src="url" style="width:13.333vw" />
😄😄I don't know if this situation is rare
@airen, @alicksnake22, @Adamwu1992 good question, but sorry, not for this solution. postcss-px-to-viewport
is a plugin for PostCSS.
@evrone: For example, I have some inline styles, how do I get
px
tovw
. eg:<div style="width: 100px"></div>
I hope it can work:
<div style="width:13.3333vw"></div>
Especially in the react project.
大漠老师,关于行内样式px转vw的问题解决了吗?
@657447158 行内样式的转换与这个插件无关,你可以用公式进行转换
@657447158 const getVwUnit = (num: number): number => num / window.screen.width * 100,num是px单位
@evrone: For example, I have some inline styles, how do I get
px
tovw
. eg:I hope it can work:
Especially in the react project.