CSS and hiding/showing divs when radio button checked

前端 未结 3 429

If the radio button #my102 is checked, the div #navi102 should be visible and all other #navi??? divs should be hidden. So, if the radio button #my7 is checked, the div #navi7 s

3条回答
  •  心在旅途
    2021-01-25 06:43

    Creating a minimal version of the code helps a great deal in this situation - your code seems to be right, but it's difficult to troubleshoot with so much going on:

    https://jsfiddle.net/17jaf4un/4/

    HTML:

    first
    second

    CSS:

    input#ch1:checked + div #d1 {
      border: 1px solid red;
    }
    
    input#ch2:checked + div #d2 {
      border: 1px solid blue;
    }
    

提交回复
热议问题