on click hide this (button link) pure css

前端 未结 3 1896
感情败类
感情败类 2020-12-10 23:28

my function is hide and show div with pure css but when i click open, the button still not disappear.



        
3条回答
  •  没有蜡笔的小新
    2020-12-10 23:51

    The click functionality can be implemented using Checkbox for pure css. I modified your HTML as follows:

    HTML

    
    
    
    some text...

    CSS

    :checked ~ .btn-default, #show, .checkbox {
        display: none;
    }
    :checked ~ #show {
        display: block;
    }
    .show-text:after {
        content:"Open";
    }
    :checked + .show-text:after {
        content:"";
    }
    .second-label, .show-text {
        text-decoration: underline;
        cursor: pointer;
    }
    

    Working Fiddle

提交回复
热议问题