标签:ems for sla nsf bsp color height 没有 flex
.parent{
position: relative;
width: 100px;
height: 100px;
border: 1px solid #ccc;
}
.child{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
background: #ddd;
}
.parent1{
display: flex;
justify-content: center;
align-items:center;
width: 200px;
height: 100px;
border: 1px solid #ccc;
}
.child1{
background: #ddd;
width: 100px;
height: 50px;
}
.parent2{
display: grid;
/* 在行中对齐方式 */
justify-items:center;
/* 在列中的对齐方式 */
align-items:center;
width: 200px;
height: 100px;
border: 1px solid #ccc;
}
.child2{
width: 100px;
height: 50px;
background: #ddd;
}
.parent3{
width:300px;
height: 100px;
position: relative;
border: 1px solid #ccc;
}
.child3{
width: 100px;
height: 50px;
position:absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
background: #ddd;
}
标签:ems for sla nsf bsp color height 没有 flex
原文地址:https://www.cnblogs.com/linxim/p/11921504.html