当前位置: 首页 > Web前端 > CSS

基于styled-components的单位px--vw自动转换

时间:2023-03-30 19:06:57 CSS

实现基于styled-components的px->vw单位转换功能详细文档请参考:styled-components.com/docs源码地址:https:///github.com/hnzycfcfed/styled-px2vw示例OutputScreenshot迁移只需要修改styled-components的导入->styled-px2vwimportstyled,{createGlobalStyle,...}from'styled-components';constButton=styled.按钮`颜色:白色;字体大小:36px;边距:10px;高度:85px;边框:2px纯淡紫红色;边界半径:3px;constButton=styled.button`颜色:白色;字体大小:36px;边距:10px;高度:85px;边框:2px纯淡紫红色;边界半径:3px;`;