Forums

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

Home Forums CSS How to set max-height using calc(Avh-Bx) and not higher than Cpx

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

    Hi,

    I have a CSS class which is like the code below.
    I am calculating the view height – 100px, but I want the result doesnt go over 700px, and also I dont want to use CSS height property, because my DIV can start with dinamic height (fitting the content), which sometimes is smaller than the calc().
    If someone could help me…

    Thanks!

    .myClass {
    max-height: calc(100vh – 100px);
    }

    #281782
    Paulie_D
    Member

    So why doesn’t max-height:700px work? I’m unclear what the difference would be.

    If 100vh-100px is less than 700px it sounds like you’ll need Javascript.

    #281783
    wellingtonfoz
    Participant

    Yes, it is because sometimes 100vh-100px is less than 700px and I dont want the div goes out of the view area.
    So, I think I have to control this using JS.

    Thanks.

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