You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. Does not removed the element from it's document flow
55
+
*/
56
+
57
+
/* .box-1 {
58
+
position: relative;
59
+
top: 100px;
60
+
left: 200px;
61
+
} */
62
+
63
+
/* Position : absolute
64
+
65
+
1. Offset from the parent element
66
+
2. Removed the element from the normal document flow
67
+
3. It is positioned relative to its closest positioned ancestor, if any; otherwise, it is placed relative to the initial containing block i.e <html> root element
68
+
*/
69
+
70
+
/* You can specify any of those position property (relative or absolute) to the parent element */
71
+
72
+
/* .container {
73
+
position: relative;
74
+
}
75
+
76
+
.box-1 {
77
+
position: absolute;
78
+
top: 100px;
79
+
left: 200px;
80
+
} */
81
+
82
+
/* Position: fixed
83
+
84
+
1. An element with position:fixed is positioned relative to the viewport
85
+
2. The top, bottom, right and left properties are used to adjust the element away from the viewport
86
+
3. The element is removed from the normal flow of the page
87
+
*/
88
+
89
+
/* .box-1 {
90
+
position: fixed;
91
+
top: 100px;
92
+
left: 100px;
93
+
} */
94
+
95
+
/* Position : Sticky
96
+
- Add a content before and after the container to make body scrollable.
0 commit comments