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
Avinash17mo ago
@Chirag
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Avinash
Avinash17mo ago
if i do that, how am i going to hide the remaining divs for the corresponding buttons?
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Avinash
Avinash17mo ago
no, actually i dont know what is :has. so i havnet tried it
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Avinash
Avinash17mo ago
i can see the working but thats not what i was looking for
b1mind
b1mind17mo 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
Avinash17mo ago
not my greatest painting but i hope you can understand what im trying to say
Avinash
Avinash17mo ago
when coloured buttons is pressed, the corresponding coloured div should go inside red div and the others shouldnt show
b1mind
b1mind17mo 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 User17mo ago
Message Not Public
Sign In & Join Server To View
Avinash
Avinash17mo 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 User17mo ago
Message Not Public
Sign In & Join Server To View
Avinash
Avinash17mo ago
only active button divs will be shown inside red div. rest will be hidden
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View