美文网首页
css div在另一个div中垂直居中

css div在另一个div中垂直居中

作者: Aurora_9e36 | 来源:发表于2022-04-25 15:13 被阅读0次
image.png

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<style>
body {
background-color:#d0e4fe;
}
.f{
width:500px;
height:500px;
display: flex;
border:1px solid red;
justify-content: center;
align-items: center;
}
.c{
width:200px;
height: 200px;
border:1px solid red;
display: flex;
justify-content: center;
align-items: center;
}
</style>
</head>

<body>

<div class="f">
    <div class="c">垂直居中</div>
</div>

</body>

相关文章

网友评论

      本文标题:css div在另一个div中垂直居中

      本文链接:https://www.haomeiwen.com/subject/pizcyrtx.html