css_居中:用flex
作者:
壮壮成长记 | 来源:发表于
2018-11-27 16:50 被阅读0次<style type="text/css">
* {
margin: 0;
padding: 0;
}
/* body{
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
} */
body{
min-height: 100vh;
display: flex;
}
.parent{
margin:auto;
}
.parent {
display: flex;
align-items: center;
justify-content: center;
}
.parent {
width: 600px;
height: 600px;
background: #808080;
}
.child {
width: 30%;
height: 30%;
background: #DAA520;
}
</style>
</head>
<body>
<div class="parent">
<div class="child"></div>
</div>
</body>
本文标题:css_居中:用flex
本文链接:https://www.haomeiwen.com/subject/qaxnqqtx.html
网友评论