HTML CSS examples for CSS Form:input radio button
Nest radio button selection
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .sub1, .sub2 { display: none; } :checked ~ .sub1, :checked ~ .sub2 { display: block; margin-left: 40px; } </style> </head> <!--from www.ja v a2 s.co m--> <body> <form> <div> <input type="radio" name="level0" value="A" id="A"> <label for="A">A</label> <div class="sub1"> <div> <input type="radio" name="level1" value="A0" id="A0"> <label for="A0">A0</label> </div> <div> <input type="radio" name="level1" value="A1" id="A1"> <label for="A1">A1</label> </div> </div> </div> <div> <input type="radio" name="level0" value="B" id="B"> <label for="B">B</label> <div class="sub1"> <div> <input type="radio" name="level1" value="B0" id="B0"> <label for="B0">B0</label> </div> <div> <input type="radio" name="level1" value="B1" id="B1"> <label for="B1">B1</label> </div> </div> </div> <div> <input type="radio" name="level0" value="C" id="C"> <label for="C">C</label> <div class="sub1"> <div> <input type="radio" name="level1" value="C0" id="C0"> <label for="C0">C0</label> </div> <div> <input type="radio" name="level1" value="C1" id="C1"> <label for="C1">C1</label> </div> </div> </div> <div> <input type="radio" name="level0" value="D" id="D"> <label for="D">D</label> <div class="sub1"> <div> <input type="radio" name="level1" value="D0" id="D0"> <label for="D0">D0</label> </div> <div> <input type="radio" name="level1" value="D1" id="D1"> <label for="D1">D1</label> <div class="sub2"> <div> <input type="radio" name="level2" value="D10" id="D10"> <label for="D10">D1-0</label> </div> <div> <input type="radio" name="level2" value="D11" id="D11"> <label for="D11">D1-1</label> </div> </div> </div> </div> </div> </form> </body> </html>