From the course: Cutting-Edge CSS
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Position explained - CSS Tutorial
From the course: Cutting-Edge CSS
Position explained
(upbeat music) - [Narrator] By default, all elements have their position properties set to static. This means the element is positioned according to the normal flow of the document. If we change the position property to relative, the element is still positioned according to the normal flow of the document. But, if we then add top, right, bottom, left, or the logical equivalence, the element is shifted relative to its original position, without effecting the surrounding elements. So, block start minus one m and inline start minus one m, places the element one m up and one m to the left of its original position. All the other elements stay the same. Change to position property, to sticky and the element acts like it's relatively positioned until the containing block, usually the immediate parent element, hits a specified threshold, typically the top of the viewport, when this happens, the elements sticks to its…