The unit of rem is relatively powerful for mobile terminals, so here I will introduce to you the installation and use of the plug-in for converting px to rem in sublime text 3. As long as you install this plug-in and enter how much px, sublime will prompt you accordingly. Rem value, you don’t have to calculate it yourself! !
1. First download the plug-in at this address: https://github.com/hyb628/cssrem.git
2. Unzip the downloaded plug-in, open sublime, find:
Sublime Text -> Preferences -> Browse Packages, and put the unzipped folder under the opened file
3. At this time, the plug-in is installed. If we enter a value we want in the css, there will be a corresponding prompt:
Enter and it will be converted automatically:
4. The 40 here is the default baseline value of the plug-in, we can change it according to our own needs:
Set in
Sublime Text -> Preferences -> Package Settings -> cssrem->Settings-user. Enter the following parameter configuration to modify the base number and converted decimal number:
{ "px_to_rem": 60, //The unit ratio of px to rem, the default is 40
"max_rem_fraction_length": 6, //The maximum length of the decimal part of px to rem. The default is 6.
"available_file_types": [".css", ".less", ".sass",".html"]
//Enable the file types of this plug-in. Default is: [".css", ".less", ".sass"]
}
After the modification, the base number has changed: