# Stick header in proper scroll position when having a custom fixed topbar on top of it

**URL:** <https://meta.discourse.org/t/stick-header-in-proper-scroll-position-when-having-a-custom-fixed-topbar-on-top-of-it/72873>\
**Category:** Product Support\
**Created:** [Outubro 26, 2017, 8:08pm UTC](https://meta.discourse.org/t/stick-header-in-proper-scroll-position-when-having-a-custom-fixed-topbar-on-top-of-it/72873 "2017-10-26T20:08:53Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![LeoDavidson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leodavidson/32/119574_2.png) [@LeoDavidson](https://meta.discourse.org/u/LeoDavidson)\
**Post date:** [Outubro 26, 2017, 9:01pm UTC](https://meta.discourse.org/t/stick-header-in-proper-scroll-position-when-having-a-custom-fixed-topbar-on-top-of-it/72873/4 "2017-10-26T21:01:30Z")

</div>

Can you think of a way to do this which would work without having a fixed-height custom header?

We have a 2 line header which will wrap to 4 lines on narrow screens (e.g. mobile). I guess it could use a fixed height dependent on the screen width and a bit of guesswork. (Not perfect as the width of the content varies over time.)

It seems that the Discourse code has an oversight here. It calculates the height of the `d-header` element, but if you do anything in Admin/Customize/Themes/Header, it is inserted above `d-header`, in a separate non-child element, and that extra height is not considered when scrolling.

It seems like the height of a common parent element should be used, or the Customize header should be inserted as a child of `d-header`.

It looks like this recent fix/commit was for something similar, but it doesn’t seem to have affected my site, so it must be something slightly different:

[https://github.com/discourse/discourse/commit/2fe2c1bfb9918ae1d49aa534027bf825a64bc4aa](https://github.com/discourse/discourse/commit/2fe2c1bfb9918ae1d49aa534027bf825a64bc4aa)

For anyone who hasn’t seen the problem, this is what happens when you use the Customize/Header option:

 ![with_header](https://global.discourse-cdn.com/meta/original/3X/5/3/5356391c4ce6a3ace6d3f0f10daba3d721313920.gif)

This is what it looks like normally, without a custom header:

 ![without_header](https://global.discourse-cdn.com/meta/original/3X/0/c/0c876a90f8591a981c5b224856d81952bfa85dc9.gif)

---

_[View the full topic](https://meta.discourse.org/t/stick-header-in-proper-scroll-position-when-having-a-custom-fixed-topbar-on-top-of-it/72873)._
