如何简单的将一个元素水平居中?

 
0 评论0 浏览
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <style>
      
        #parent {
            height: 200px;
            display: flex;
            justify-content: center;
            align-items: center;

        }
    </style>
</head>
<body>
<div   id="parent">
<img src="https://static.hacpai.com/images/favicon.png">

</div>

</body>
</html>


            

文章仅在黑客派和本网站刊登,其他为盗载。