為什么我這個(gè)圖像沒有居中
<!DOCTYPE html>
<html>
<head>
? ? <meta charset="UTF-8">
? ? <title>已知寬高實(shí)現(xiàn)盒子水平垂直居中</title>
? ? <style type="text/css">
? ? .box {
? ? ? ? border: 1px solid #00ee00;
? ? ? ? height: 300px;
? ? ? ? position:relative;
? ? }
? ? .box1 {
? ? ? ? position:absolute;
? ? ? ? top:50%;
? ? ? ? left:50%;
? ? ? ? margin:-100px? 0 0 -100px;
? ? ? ? width: 200px;
? ? ? ? height: 200px;
? ? ? ? border: 1px solid red;
? ? ? ??
? ? }
? ? </style>
</head>
<body>
? ? <div class="box">
? ? ? ? <div class="box1"></div>
? ? </div>
</body>
</html>
2021-03-28
position:relative;這個(gè)代碼有誤,此冒號非英文輸入法的冒號。