1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title></title> 6 <style> 7 .box{ 8 width: 200px; 9 height: 200px; 10 border: 10px solid #000; 11 } 12 .content{ 13 width: 400px; 14 height: 400px; 15 background-color: red; 16 } 17 </style> 18 <!-- 19 解决方案: 20 不要让子元素的宽高超过父级 21 --> 22 </head> 23 <body> 24 <div class="box"> 25 <div class="content"></div> 26 </div> 27 </body> 28 </html>