Skip to content

Instantly share code, notes, and snippets.

@usmaanalii
Created August 24, 2017 09:01
Show Gist options
  • Save usmaanalii/2504f69e86c0b71e0bbd4801c444b506 to your computer and use it in GitHub Desktop.
Save usmaanalii/2504f69e86c0b71e0bbd4801c444b506 to your computer and use it in GitHub Desktop.

What I learned on this mini-project.

position: fixed

The main purpose of this project was to learn about the effects of changing an elements position to fixed.

When applying this property, the element is essentially taken out of the DOM which vacates the space it previously held in it.

This causes a reshuffle for the other elements, which can cause a judder when an elements position is changed to fixed.

https://gist.github.com/3596d40f876bb7388fcd40dfb0febece

One workaround to this, is to fill in the space vacated by adding padding. This can be done multiple ways, but it makes sense to make this value dynamic, so that it adapts when the layout of the page is changed.

https://gist.github.com/d57e4a9845b116dc750a4417a47927f4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment