Forums

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

Home Forums CSS Hide child element if parents height gets too small

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

    I want to hide the child element if the height of the parent falls below a certain threshold. The height is determined by the text content of the parent. Is there a css-only solution?
    I am searching for something like this:

    parent[height<="60"] child {
       display: none;
    }
    

    I made a Pen to illustrate the problem: http://codepen.io/anon/pen/EjVEYV

    #201816
    Egp
    Participant

    Can’t you somehow test whether the whole screen is some height, with @media?

    @media screen and (max-height: 1660px) /* your 60+ something?*/
        {   child { display: none; }
        }
    

    Just a thought, but I’m interested too, if you find a workable solution…
    Cheers,

    #201938
    rafaeljuarez
    Participant

    Its only achievable by jquery.

    if you want the code i can provide it :D

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