How to Use CSS Position Fixed - A Beginner's Guide

Published: 22 October 2021
on channel: Front End Beginners
308
9

In this tutorial, we look at how to use CSS "position: fixed".

When combined with top, bottom, left, or right positioning properties, "position: fixed" allows you to place an HTML element anywhere on the page.

Fixed positioned items are removed from the normal document flow and no space is created for them—effectively, other elements on the page act as if the fixed positioned element doesn't exist.

Fixed positioned elements are placed relative to the edges of the viewport, or browser window. Fixed positioned elements do not follow the default scroll behaviour, and remain "fixed" to their position relative to the window when scrolling.

"Position: fixed" also affects the normal stacking context, but z-index values or the position: relative property can be used to adjust this.

I hope you found this video helpful. If you have any questions, please leave them in the comments below and I'll do my best to answer as soon as possible.

TIMESTAMPS:
00:00 Introduction to position: fixed
01:13 Practical example - effect on normal document flow
02:24 Positioning with top, bottom, left, or right values
03:01 Position: fixed and the "initial containing block"
03:46 Combining multiple top, bottom, left, and right values
04:30 "Position: fixed" vs "position: absolute"
05:09 Position: fixed scroll behaviour
05:55 Position: fixed and the "stacking context"
07:20 Restoring "stacking context" with z-index or position: relative
09:33 Recap/conclusion

WATCH NEXT:
• How to Use Position Relative -    • How to Use CSS Position Relative - A ...  
• How to Use Position Absolute -    • How to Use CSS Position Absolute - A ...  
• How to Use Position Sticky -    • How to Use CSS Position Sticky - A Be...  


Watch video How to Use CSS Position Fixed - A Beginner's Guide online without registration, duration hours minute second in high quality. This video was added by user Front End Beginners 22 October 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 30 once and liked it people.