Good day! I have such a problem I can not figure out how to make a fixed menu, like here for example http://news.mail.ru . So that when we move down the site, the menu is always hung in the header and visible. How to do it? Who did this?

    2 answers 2

    Plugin on this topic in the internet is enough. And if you do not need any special problems, then you can write yourself in a few minutes.

      In css styles for your menu, set position: fixed

      • @alvoro, I still have this question, when you do this, it immediately throws the menu into the upper left corner, but can you somehow set the relative positions to center for example the menu horizontally? - IntegralAL
      • @IntegralAL use css-properties top, left, right, bottom. They are responsible for the offset. - alvoro
      • @IntegralAL, because a fixed element is always positioned relative to the browser window. Use top: 0 to press the element to the top of the window and the margin-left / right to position the element along the x coordinate, if you want the count to be taken from the current position. - Andreyqin
      • @andreyqin why are there more to push the margins? that's all with pure top-left , the margin still works for indents, and top-left for offset. - alvoro
      • @alvoro, I wrote "a fixed element is always positioned relative to the browser window." And relative to the window, we need to position it only on the Y coordinate. - andreyqin