Forums

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

Home Forums CSS SideNav: 'push in' desktop, 'overlay' mobile

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #264635
    Dyd
    Participant

    Here’s what i want to achieve: https://i.stack.imgur.com/cDw8U.png
    Here’s what i got so far: https://codepen.io/dyd666/pen/wpJjKq

    It’s pushing in on desktop but not ‘overlaying’ on mobile. How can i do that?

    Thanks ; )

    #264637
    Beverleyh
    Participant

    To overlay, null/don’t use the left margin here;

    #secret-checkbox:checked ~ .content{
      margin-left: 150px;
    }
    

    You’ll need to use a media query to change the behaviour at whatever mobile/desktop threshold you see fit.

    #264638
    Dyd
    Participant

    Cool, now it works.
    Only problem: the side nav is coming from left to right even on mobile.
    How can i make it appear from top to bottom?

    Thanks

    #264639
    Beverleyh
    Participant

    Think about it logically by looking at what’s already there; if a change in left values cause the menu to move sideways/horizontally when the checkbox is checked/unchecked, have a play around with top values to see how that affects the movement vertically.

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