Layer 100% with "margin"

  • Hello,

    There's something I didn't quite understand about the positioning of the layers.

    Basically, I'd like to have a container layer that takes up 100% of the safezone (or at least the viewport), minus a margin (say 30px top, right, left, and for the bottom, the size of the controlbar + 30px).

    I've tried a width="calc:100%-60px", but the 100% isn't taken into account.

    Are there any variables that could help me?

  • Thank you very much Klaus, this has enabled me to make the little lightbox I needed.

    I do have one small problem though.

    With my code, if I want to display a horizontal image on mobile, it goes outside the margins defined in the boxbg layer.

    How can I ensure that the image in the boximg layer is displayed at 100% of both axes of the parent (boxbg), without the margins and while maintaining its aspect ratio?

    Last little question, is there anything else I need to optimise in my code?


    Thank you

    Edited once, last by MrSoul (August 29, 2024 at 5:47 PM).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!