ÎÒÊÇʹÓÃsassÀ´Ð´cssµÄ£¬¾ßÌåÈçÏ£º
1¡¢variable.scss
ÔÚvariable.scssÎļþÖж¨ÒåÒ»¸ö ±äÁ¿$base_fontSizeÀ´ÉèÖûù±¾×ÖÌå´óС£¨ÎÒʹÓõÄÊǰٷֱȣ¬¼´¸ù¾Ýä¯ÀÀÆ÷×ÖÌåĬÈÏÖµÔÙ³ËÒÔÕâ¸ö°Ù·Ö±È£©¡£
//font-size $base_fontSize:62.5%;
2¡¢base.scss
ÔÚbase.scssÖÐÒýÈëÉÏÃæÄǸö±äÁ¿Îļþ£¨sassÓï·¨Çë×ÔÐаٶȣ©£¬È»ºóÉèÖÃhtml×ÖÌåµÄ³õʼֵΪ$base_fontSize£¬½ÓÏÂÀ´Í¨¹ýýÌå²éѯ¸ù¾ÝÒƶ¯É豸ÆÁÄ»´óС¶Ô±ä$base_fontSizeÖØи³Öµ£¬²¢¶Ôhtml×ÖÌå´óСÖØи³ÖµÎª1rem¡£ÕâÑù¾ÍÄܺܺõļæÈݳ¬Ð¡ÊÖ»úÖÁpadµÄËùÓÐÆÁÄ»¡£µ±È»£¬Ã¿´Î¶Ô$base_fontSize½øÐÐÖØи³ÖµµÄ°Ù·Ö±È¿ÉÒÔ×Ô¼º¸ù¾ÝÐèÒª¶ø¶¨¡£
@import 'variable.scss'; html { font-size: $base_fontSize; } @media only screen and (min-width: 481px){ $base_fontSize:$base_fontSize*94%; html { font-size: 1rem!important; } } @media only screen and (min-width: 561px){ $base_fontSize:$base_fontSize*109%; html { font-size: 1rem!important; } } @media only screen and (min-width: 641px){ $base_fontSize:$base_fontSize*125%; html { font-size: 1rem!important; } }
3¡¢ÔÚhtmlÒ³ÀïÒýÓÃbase.scssÉú³ÉµÄbase.cssÎļþ¼´¿É
¡¡