Bootstrap

嵌套盒子,让子div在父div中居中

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <style>
        #parent{
            width: 300px;
            height: 300px;
            background-color: #cccccc;
            overflow: hidden;
        }
        #child{
            width: 150px;
            height: 150px;
            background-color: #FF6500;
            margin: 0 auto;
            margin-top: 75px;
        }
    </style>
    <title>嵌套的盒子</title>
    <!--解决方案
         1.为父盒子添加overflowhidden
         2.为父盒子添加padding
         3.为父盒子添加border-->
</head>
<body>
   <div id="parent">
       <div id="child"></div>
   </div>
</body>
</html>
;