css 常见问题

来源:互联网 发布:杀破狼 js原版 编辑:程序博客网 时间:2024/06/06 03:13

相对布局: 相对是是自己
例如:
position: relative;
left:2%; // 相对自己离左边 2%
bottom: 45%; 相对自己离下面 45%

绝对布局:相对的是父元素(父元素必须设置布局)、
position: absolute;
left:2%; // 相对自己离左边 2%
bottom: 45%; 相对自己离下面 45%

居中显示:
display: flex;
align-items: center;
justify-content: center;