嵌套DIV居中
box2 默认样式,靠左
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<style>
.box1 {
width: 500px;
height: 500px;
background-color: #bfa;
}
.box2 {
width: 100px;
height: 100px;
background-color: #f00;
}
</style>
</head>
<body>
<div class="box1">
<div class="box2"> box