代码;
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> /* 2 直接使用rem单位 */ .box{ width: 5.33rem; height: 5.33rem; background-color: skyblue; } </style> </head> <body> <div class="box"></div> <!-- 1 引入js文件 已经根据不同的视口宽度设置好了根字号大小 --> <script src="./js/flexible.js"></script> </body> </html>
效果图:
移动web-rem+flexible.js适配案例
最新推荐文章于 2023-11-21 11:27:20 发布