标签:兼容 vertica htm ice table lang center content enter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.clearFix::after{
display:block;
clear:both;
content:"";
visibility:hidden;
height:0;
}
.clearFix{
zoom: 1;
}
.container{
width: 100%;
height: 800px;
background-color: blue;
/* 水平垂直居中 */
position: relative;
}
.child1{
width:200px;
height:200px;
background-color: red;
}
.child2{
width:200px;
height: 200px;
background-color: goldenrod;
}
.lf{
float: left;
}
/* 水平垂直居中 */
.box{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
</style>
</head>
<body>
<div class="container clearFix">
<div class="box clearFix">
<div class="child1 lf">child1</div>
<div class="child2 lf">child2</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.clearFix::after{
display:block;
clear:both;
content:"";
visibility:hidden;
height:0
}
.clearFix{
zoom: 1;
}
.container{
width: 100%;
height: 800px;
background-color: blue;
display: flex;
/* 垂直居中 */
align-items: center;
/* 水平居中 */
justify-content:center;
}
.child1{
width:200px;
height:200px;
background-color: red;
}
.child2{
width:200px;
height: 200px;
background-color: goldenrod;
}
.lf{
float: left;
}
</style>
</head>
<body>
<div class="container clearFix">
<div class="child1 lf">child1</div>
<div class="child2 lf">child2</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.clearFix::after{
display:block;
clear:both;
content:"";
visibility:hidden;
height:0;
}
.clearFix{
zoom: 1;
}
.container{
width: 600px;
height: 800px;
background-color: blue;
/* 水平垂直居中 */
display: table-cell;
vertical-align: middle;
}
.child1{
width:200px;
height:200px;
background-color: red;
}
.child2{
width:200px;
height: 200px;
background-color: goldenrod;
}
.lf{
float: left;
}
/* 水平垂直居中 */
.box{
width:400px;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="container clearFix">
<div class="box clearFix">
<div class="child1 lf">child1</div>
<div class="child2 lf">child2</div>
</div>
</div>
</body>
</html>
标签:兼容 vertica htm ice table lang center content enter
原文地址:https://www.cnblogs.com/web-record/p/9144359.html