CSS水平垂直中央レイアウト
539 ワード
1 inline-block+text-align+table-cell+vertical-align
2 absolute+transform
3 flex+justify-content+align-items
.parent{
text-align: center;
display: table-cell;
vertical-align: middle;
}
.child{
display: inline-block;
}
2 absolute+transform
.parent{
position: relative;
}
.child{
position: absolute;
top:50%;
left:50%;
transform: translate(-50%,-50%);
}
3 flex+justify-content+align-items
.parent{
display: flex;
justify-content: center;
align-items:center;
}