利用Flexbox来实现水平垂直居中
作者:
凌Linny | 来源:发表于
2017-03-05 13:36 被阅读0次<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>居中</title>
<style type="text/css">
.container {
display: flex;
justify-content:center; /*水平居中*/
align-items:center; /*垂直居中*/
width: 200px;
height: 200px;
background-color: #ccc;
}
.center-p {
background-color: yellow;
}
</style>
</head>
<body>
<div class="container">
<div class="center-p">
flex居中
</div>
</div>
</body>
</html>
Paste_Image.png
本文标题:利用Flexbox来实现水平垂直居中
本文链接:https://www.haomeiwen.com/subject/yygsgttx.html
网友评论