Responsive navbar
how can I manipulate the left-nav class when checkbox in responsive-nav class is checked.
16 Replies
witj javascript ?
no only css
can you change the HTML?
i am trying to do it without changing
Then I think it will be a very very difficult css
do you need to support firefox?
I'm just learning
right, then I don't think you can at this point. There's the
:has
relational pseudo-class, but it doesn't have great support yet
it's very hard to affect things higher in the DOM based on things lower in the DOM in CSS
often it's entirely impossibleI agree , when you do the checkbox just before it will be very easy to do what you want
so do you want me to move responsive-nav class above left-nav class and I can use the sibling selector
thanks for the advice
yeah, that's currently the best way to use the checkbox trick, using the sibling selector
thank you for the quick responses
yep, I used it several times that way for a accordion and a hambuger menu
YW
there's a demo for :has, which works for about 85% of people https://caniuse.com/css-has
This hasn't changed your HTML at all
https://codepen.io/jochemm/pen/RwqomEW
also you're welcome, but keep in mind we're not always this quick, sometimes it can take a while for people to respond.
👍
now do i need to end this post or something
you can add a solved tag, that's good enough
thanks!