Guest Posted March 12, 2021 Share Posted March 12, 2021 Site URL: https://www.alberta-avenue.com/test-webpage I have a code for Collapsible list which works on a normal webpage as intended but when I use it in the codes block it does not expand the list upon clicking. Can anyone help me out here please? Thanks! Here is a code snippet: <head> <style type="text/css"> .row { vertical-align: top; height:auto !important; } .list {display:none; } .show {display: none; } .hide:target + .show {display: inline; } .hide:target {display: none; } .hide:target ~ .list {display:inline; } @media print { .hide, .show { display: none; } } </style> </head> <body> <!--The first block--> <div class="row"> <a href="#hide1" class="hide" id="hide1">click to show</a> <a href="#show1" class="show" id="show1">click to collapse</a> <div class="list"> <ul> *****A bunch of Lists using <li> tag****** </ul> </div> </div> </body> Link to comment
tuanphan Posted March 23, 2021 Share Posted March 23, 2021 Hi. Try adding this to Code Block <style type="text/css"> .trow { vertical-align: top; height:auto !important; } .list {display:none; } .show {display: none; } .hide:target + .show {display: inline; } .hide:target {display: none; } .hide:target ~ .list {display:inline; } @media print { .hide, .show { display: none; } } </style> <!--The first block--> <div class="trow"> <a href="#hide1" class="hide" id="hide1">click to show</a> <a href="#show1" class="show" id="show1">click to collapse</a> <div class="list"> <ul> *****A bunch of Lists using <li> tag****** </ul> </div> </div> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.