代码改变世界

弹性盒子模型子元素垂直和水平居中

2018-03-05 16:38  盛世游侠  阅读(12200)  评论(0编辑  收藏  举报
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.out {
width: 500px;
height: 300px;
background: red;
display: flex;
justify-content: center;
align-items: center;
margin: 0 auto;
}
.out .in {
width: 100px;
height: 100px;
background: white;
}
</style>
</head>
<body>
<div class="out">
<div class="in">

</div>
</div>
history.pushState({ title: attrs.title }, attrs.title, urlStr);    
history.pushState({ title: document.title }, document.title, urlStr);
</body>
</html>