How to toggle Effect in Div using only css?

前端 未结 3 1877
自闭症患者
自闭症患者 2021-02-09 06:34

Note: I tried all questions & answers related this topic. Additionally and I tried related questions and try to solve it but not success. So please read m

3条回答
  •  心在旅途
    2021-02-09 06:56

    you achieve that using checkbox with some css manipulation

    div input {
      margin-right: 100px;
    }
    
    .check-btn label {
      display: inline-block;
    }
    
    .check-btn input {
      display: none;
    }
    
    .clicker {
      background: green;
      padding: 5px 10px;
    }
    
    .hiddendiv {
      background: #000;
      width: 100px;
      height: 100px;
      display: none;
    }
    
    .check-btn input:checked ~ .hiddendiv {
      display: block;
    }

    Here jsfiddle

提交回复
热议问题