- 给父元素设置背景颜色属性不起作用
- 给父元素设置边框 border属性没有被撑开
- 给父元素设置内边距 padding属性也没有被撑开
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title></title> 6 <style type="text/css"> 7 .box{ 8 border: 10px solid red; 9 background-color: aqua; 10 padding: 10px; 11 } 12 .left,.right{ 13 width: 200px; 14 height: 200px; 15 float: left; 16 } 17 .left{ 18 background-color: #7FFF00; 19 } 20 .right{ 21 background-color: #FF7F50; 22 } 23 </style> 24 </head> 25 <body> 26 <div class="box"> 27 <div class="left"></div> 28 <div class="right"></div> 29 </div> 30 </body> 31 </html>