W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/js/bootstrap.bundle.min.js"></script> </head> <body> <div class="container mt-3"> <h2>可切换的 / 动态选项卡</h2> <br> <!-- Nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li class="nav-item"> <a class="nav-link active" data-bs-toggle="tab" href="#home">春日</a> </li> <li class="nav-item"> <a class="nav-link" data-bs-toggle="tab" href="#menu1">初夏</a> </li> <li class="nav-item"> <a class="nav-link" data-bs-toggle="tab" href="#menu2">山行</a> </li> </ul> <!-- Tab panes --> <div class="tab-content"> <div id="home" class="container tab-pane active"><br> <h3>春日</h3> <p>胜日寻芳泗水滨,无边光景一时新。</p> <p>等闲识得东风面,万紫千红总是春。</p> </div> <div id="menu1" class="container tab-pane fade"><br> <h3>初夏绝句</h3> <p>纷纷红紫已成尘,布谷声中夏令新。</p> <p>夹路桑麻行不尽,始知身是太平人。</p> </div> <div id="menu2" class="container tab-pane fade"><br> <h3>山行</h3> <p>远上寒山石径斜,白云生处有人家。</p> <p>停车坐爱枫林晚,霜叶红于二月花。</p> </div> </div> </div> </body> </html>