-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathposition-fixed-sticky.css
More file actions
61 lines (55 loc) · 1.03 KB
/
position-fixed-sticky.css
File metadata and controls
61 lines (55 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
body {
margin: 0;
font-family: sans-serif;
position: relative;
}
.overlay {
background: linear-gradient(to top, #fff, transparent);
position: absolute;
z-index: 20;
width: 100%;
bottom: 0;
height: 100%;
}
.contenedor {
padding: 150px;
background-color: #00f;
position: relative;
}
h2 {
font-size: 18px;
margin: 0;
}
p {
font-size: 14px;
margin: 0;
}
/* Position fixed -> Posición fija y se puede desplazar a cualquier lugar */
.box {
height: 60px;
width: 200px;
background-color: #f00;
position: fixed;
right: 0;
background-color: #fff;
border: 2px solid #000;
border-right: 0;
box-shadow: 0px 0px 40px #0009;
z-index: 30;
}
/* Position sticky -> Se comporta como un relative, pero al posicionar se queja fija */
.box-fixed {
height: 60px;
width: 200px;
background-color: #f00;
position: sticky;
top: 100px;
z-index: 40;
box-sizing: border-box;
}
.first:first-child {
top: 10px;
}
.last:last-child {
top: 170px;
}