首页 > 其他 > 详细

元素水平垂直居中

时间:2017-09-13 09:47:19      阅读:288      评论:0      收藏:0      [点我收藏+]

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
div{
position: absolute;

background: red;

/*
width:200px;
height:300px;
left:0;
top:0;
right:0;
bottom:0;
margin:auto; */

 

/* width:200px;
height:300px;
left:50%;
top:50%;
margin-left:-100px;
margin-top:-150px; */

/* width:30%;
height:50%;
left:50%;
top:50%;
transform:translateX(-50%) translateY(-50%); */

display:flex;
width:200px;
height:200px;
align-item:center;
justify-content:center;

}

</style>
</head>
<body>
<div></div>
</body>
</html>

元素水平垂直居中

原文:http://www.cnblogs.com/wifi-wangji/p/7513391.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!