LeonLatex Posted March 30, 2023 Share Posted March 30, 2023 Yes, I know, you have told me the solution to this problem before, but now I got the same problem. My header bar is moving up and down when scrolling. I am using position: sticky; but it still goes up and down. What is the problem? div.header_container { background-color: #033333; position: sticky; height: 83px; width: 100%; padding-top: 0px; margin-top: 0px; } div.logo_bar { background-color: #033333; width: 100%; height: 47px; } div.logo_div { background-image: url("../images/logo_bg_original.png"); width: 300px; height: 35px; margin-top: 0px; } div.menu_bar { font-size: 13px; font-weight: bold; background-color: #ffffff; width: 100%; } div.menu_div { background-color: #ffffff; width: 100%; } Quote Link to comment https://forums.phpfreaks.com/topic/316068-topheader-div-wont-lock-when-scrolling/ Share on other sites More sharing options...
Solution maxxd Posted March 31, 2023 Solution Share Posted March 31, 2023 A sticky element needs to have a `top` value. Remember it's relative to the parent element, so if that goes off the screen, the sticky element will as well. 1 Quote Link to comment https://forums.phpfreaks.com/topic/316068-topheader-div-wont-lock-when-scrolling/#findComment-1606961 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.