CSS 定位布局

2021年10月15日 99 字 CSS

CSS个人整理

Static 静态定位(默认)

从上到下 从左到右

1
2
3
.box{
position: static
}

Relative 相对定位

1
2
3
4
5
.box2{
position: relative;
left: 15px;
top:15px;
}

Absolute 绝对定位

1
2
3
4
5
.box3{
position: Absolute;
left: 15px;
top:15px;
}

Fixed 固定定位

1
2
3
4
5
6
.footer{
position: fixed;
bottom: 0;
left:0;
right:0;
}

Sticky 粘性定位

1
2
3
4
5
6
.footer{
position: fixed;
bottom: 0;
left:0;
right:0;
}

本文作者: 史迪奇
本文链接: https://sdq3.link/CSS-Static-Relative-Absolute-Fixed-Sticky.html