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