源代碼
點擊運行
<!DOCTYPE html> <html> <head> <title>Foundation 實例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdn.staticfile.org/foundation/5.5.3/css/foundation.min.css"> <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdn.staticfile.org/foundation/5.5.3/js/foundation.min.js"></script> <script src="https://cdn.staticfile.org/foundation/5.5.3/js/vendor/modernizr.js"></script> </head> <body> <div style="padding:20px;"> <h2>開關組</h2> <p>可以通過設置單選按鈕(radio)來設置單個選項。<strong>注意:</strong> 注意各個選項的 <code>name</code> 屬性必須一致 (實例中為 "myGroup" )。</p> <form> <div class="switch"> <input id="mySwitch1" type="radio" name="myGroup"> <label for="mySwitch1"></label> </div> <div class="switch"> <input id="mySwitch2" type="radio" checked name="myGroup"> <label for="mySwitch2"></label> </div> <div class="switch"> <input id="mySwitch3" type="radio" name="myGroup"> <label for="mySwitch3"></label> </div> </form> </div> </body> </html>
運行結果