how to enable a div from a set of divs when corresponding button is clicked, without JS?

i have a parent div with 3 buttons and a child div with another 3 div inside child. the button 1 is active and the child div displays 3 div, when button 2 is active, child div should replace the existing 3 divs with another sets of 4 divs, etc. How should i proceed this? i used zindex but its not working as intended.
16 Replies
Avinash
AvinashOP2y ago
@Chirag
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Avinash
AvinashOP2y ago
if i do that, how am i going to hide the remaining divs for the corresponding buttons?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Avinash
AvinashOP2y ago
no, actually i dont know what is :has. so i havnet tried it
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Avinash
AvinashOP2y ago
i can see the working but thats not what i was looking for
b1mind
b1mind2y ago
Don't make your question a word math problem. I'm not the brightest cookie but this is so hard to determine what you are after. Provide a codepen of what you are doing.
Avinash
AvinashOP2y ago
not my greatest painting but i hope you can understand what im trying to say
Avinash
AvinashOP2y ago
when coloured buttons is pressed, the corresponding coloured div should go inside red div and the others shouldnt show
b1mind
b1mind2y ago
Without JS you are not going to be able to do what you are asking, unless you do some trickery with multiple elements hidden and revealing. If you want the actual divs to move inside the other you will want to use whats called FLIP technique (with JS)
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Avinash
AvinashOP2y ago
i issue is there is more content inside the child divs, so doing it in js is going to be a big headache. i thought of stacking 3 divs on top of each other and changing zinded based on the active button @b1mind buttons will show, only its corresponding divs will be hidden @Chirag
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Avinash
AvinashOP2y ago
only active button divs will be shown inside red div. rest will be hidden
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server