Hide Show content-list with only CSS, no javascript used

前端 未结 12 1559
长发绾君心
长发绾君心 2020-11-28 23:18

I\'ve been searching for a good trick to make a Hide/Show content or a list with only CSS and no javascript. I\'ve managed to make this action:



        
12条回答
  •  既然无缘
    2020-11-29 00:06

    This is going to blow your mind: Hidden radio buttons.

    input#show, input#hide {
        display:none;
    }
    
    span#content {
        display:none;
    }
    input#show:checked ~ span#content {
      display:block;
    }
    
    input#hide:checked ~ span#content {
        display:none;
    }
    
    
        
    
    Content

提交回复
热议问题