.center {
margin: 0 auto;
width: 800px; /* 必須指定寬度 */
}
.abs-center {
position: absolute;
width: 400px; /* 必須指定寬度 */
left: 50%;
margin-left: -200px; /* 負 margin 為寬度一半 */
}
.fixed-bottom {
position: fixed; /* 或 absolute 視需求 */
width: 400px;
left: 50%;
margin-left: -200px;
bottom: 0;
}
fixed 相對視窗定位,absolute 相對最近定位祖先元素定位。