Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Calc x margin from top | CSS

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #262108
    vulkanus
    Participant

    Hi,

    There is anyway to calculate from above for any part of the container without @query, the idea is to position an element below the menu, and used for any screen/dimension, because if you have a screen with 1920 and you change to 1680 or low the some element goes a little down.

    Thank you.

    #262124
    JeroenR
    Participant

    Maybe you can use this: https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect

    Not sure what it exactly is what you’re trying to achieve here, but with this function you can get dimensions and position of an element.
    But it seems better to just have the element you’re trying to position, in the same context as the menu.

    #262135
    vulkanus
    Participant

    Hi JeroenR,

    I understand, but what I really want, is to position an element above the menu, like body container and use it for any screen, but I belive I have found another way to do that, I have gave a body{margin-top:xxx; } and I have tested and the container above the menu stay where I want (more or less) in any resolution.

    Thanks.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.