[Resolved] Fixed container height for mobile browsers

Home Forums Support [Resolved] Fixed container height for mobile browsers

Home Forums Support Fixed container height for mobile browsers

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1390760
    Christian Lux

    Is there a way in css to fix the container height for mobile browsers? The one you gave me for desktop doesn’t seem to be working for mobile.

    Kind Regards
    Christian

    #1390927
    David
    Staff
    Customer Support

    Hi there,

    you can remove the CSS from the @media query. So instead of this CSS:

    @media (min-width: 769px) {
        #page {
            min-height: calc(100vh - 350px);
        }
    }

    you do this:

    #page {
        min-height: calc(100vh - 350px);
    }
    #1390965
    Christian Lux

    Seems like it is stoll not high enough.

    not working

    #1391004
    David
    Staff
    Customer Support

    You could do this instead:

    /* Desktop */
    @media (min-width: 769px) {
        #page {
            min-height: calc(100vh - 350px);
        }
    }
    /* Mobile
    @media (max-width: 768px) {
        #page {
            min-height: calc(100vh - 294px);
        }
    }

    Which uses a different height for the deducted elements ( header , nav , footer ) on mobile.
    But the problem is the height of the header changes as the screen size reduces due to the logo rescaling.

    Theres no simple and efficient fix to that other then using a fixed size header for mobile.

    #1391870
    Christian Lux

    How do I set a fixed header for mobile?

    #1392089
    Tom
    Lead Developer
    Lead Developer

    I’m not sure you need to. If you add up your site header + navigation height, you get 194.8.

    So you should be able to do this:

    @media (max-width: 768px) {
        #page {
            min-height: calc(100vh - 194.8px);
        }
    }
    #1392093
    Christian Lux

    Thanks alot, it works now ๐Ÿ™‚

    #1392095
    Tom
    Lead Developer
    Lead Developer

    You’re welcome ๐Ÿ™‚

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.