1 <!DOCTYPE html> 2 <html lang="en" style="font-size: 20px"> 3 <!-- style="font-size: 20px" 设置1rem单位为20px --> 4 <head> 5 <meta charset="UTF-8" > 6 <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> 7 <title>Document</title> 8 <style type="text/css"> 9 body{ 10 margin: 0 11 } 12 .box1{ 13 font-size: 16px; 14 width: 20rem; 15 height: 10rem; 16 background-color: gold; 17 /* 宽等于20*20 高等于10*20 */ 18 } 19 </style> 20 </head> 21 <body> 22 <div class="box1">1</div> 23 <div class="box2"></div> 24 </body> 25 </html>