W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</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> <p>如需在 Bootstrap 5 中设置选择菜单的样式,请将 .form-select 类添加到 select 元素:</p> <form action="/demo/html/action_page.php"> <label for="sel1" class="form-label">选择菜单(选择一项):</label> <select class="form-select" id="sel1" name="sellist1"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> <br> <label for="sel2" class="form-label">多选菜单(按住 ctrl 或 shift(或用鼠标拖动)可选择多个):</label> <select multiple class="form-select" id="sel2" name="sellist2"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select> <button type="submit" class="btn btn-primary mt-3">提交</button> </form> </div> </body> </html>