Reprinted from: https: //www.cnblogs.com/heyode/p/5973960.html
<body> <div class="wrap"> <div class="content"></div> </div> <style> body { margin: 0; padding: 0; } .wrap { border: 1px solid black; width:800px; } .content { width: 500px; height:400px; background-color: aqua; } </style> </body>
Here, we do not have to wrap set height, it defaults to Auto . When the height is set to auto, height determines the height of its sub-label of the label, namely: sub-label distraction parent tag.
Div and the default value of 100% of the width of the label. If, no wrap width attribute,
<body> <div class="wrap"> <div class="content"></div> </div> <style> .wrap { border: 1px solid black; } .content { width: 500px; height:400px; background-color: aqua; } </style> </body>
Results are as follows: