# Header position question

**URL:** <https://forum.freecodecamp.org/t/header-position-question/178001>\
**Category:** General\
**Created:** [March 5, 2018, 3:49am UTC](https://forum.freecodecamp.org/t/header-position-question/178001 "2018-03-05T03:49:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gvsorokin](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@gvsorokin](https://forum.freecodecamp.org/u/gvsorokin)\
**Post date:** [March 5, 2018, 3:49am UTC](https://forum.freecodecamp.org/t/header-position-question/178001/1 "2018-03-05T03:49:27Z")

</div>

So i want to create a header like here [https://codepen.io/freeCodeCamp/full/YqLyXB](https://codepen.io/freeCodeCamp/full/YqLyXB) , and i kind of did, but im not sure how am i supposed to make it stay at the top at all times. I googled it and i got this position thing so now i cant choose between fixed and sticky, can someone explain me the difference? I guess theres a problem with fixed because it can make ur header collapse onto the other parts but u can avoid it by setting height

---

<div class="post-metadata">

**Author:** ![lucasarvelo](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lucasarvelo/32/114742_2.png) [@lucasarvelo](https://forum.freecodecamp.org/u/lucasarvelo)\
**Post date:** [March 5, 2018, 4:08am UTC](https://forum.freecodecamp.org/t/header-position-question/178001/2 "2018-03-05T04:08:21Z")

</div>

I hope this helps with your question.

[https://air.mozilla.org/intern-presentation-ford/](https://air.mozilla.org/intern-presentation-ford/)

---

<div class="post-metadata">

**Author:** ![gvsorokin](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@gvsorokin](https://forum.freecodecamp.org/u/gvsorokin)\
**Post date:** [March 5, 2018, 4:30am UTC](https://forum.freecodecamp.org/t/header-position-question/178001/3 "2018-03-05T04:30:18Z")

</div>

it does, thank u sir.

---

<div class="post-metadata">

**Author:** ![gvsorokin](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@gvsorokin](https://forum.freecodecamp.org/u/gvsorokin)\
**Post date:** [March 5, 2018, 4:39am UTC](https://forum.freecodecamp.org/t/header-position-question/178001/4 "2018-03-05T04:39:11Z")

</div>

so its basically like fixed that is not fixed for the whole page, but only for some part of it, right?

---

<div class="post-metadata">

**Author:** ![owel](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/owel/32/48425_2.png) [@owel](https://forum.freecodecamp.org/u/owel)\
**Post date:** [March 5, 2018, 5:10am UTC](https://forum.freecodecamp.org/t/header-position-question/178001/5 "2018-03-05T05:10:43Z")

</div>

position: sticky works with a page offset.

For example, if applied to a div, with a top offset, the div element will scroll along with the page normally, until it hits the top offset position, and then it will “stick” to that specific position. The effectt is the rest of your page elements scrolls by, while this div is “stuck” at that offset position.

---

<div class="post-metadata">

**Author:** ![lucasarvelo](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lucasarvelo/32/114742_2.png) [@lucasarvelo](https://forum.freecodecamp.org/u/lucasarvelo)\
**Post date:** [March 5, 2018, 5:14am UTC](https://forum.freecodecamp.org/t/header-position-question/178001/6 "2018-03-05T05:14:42Z")

</div>

Something like that, I see it like “the way that the element is interacting with the rest of the elements”, I’m thinking that position in CSS is about how the elements interact between them.

> **[CSS "position: sticky" - Introduction and Polyfills — SitePoint](https://www.sitepoint.com/css-position-sticky-introduction-polyfills/)**
>
> Aurelio De Rosa takes a look at some JavaScript solutions for sticky navigation, while introducing CSS's new position: sticky feature, along with some polyfills.

This post has some examples that I’m sure will help you to understand when using sticky or fix.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:25pm UTC](https://forum.freecodecamp.org/t/header-position-question/178001/7 "2021-01-17T20:25:12Z")

</div>

Closed on January 17, 2021, 8:25pm UTC


