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> <p>.input-group 类是一种容器,通过在输入字段的前面或后面添加图标、文本或按钮作为“帮助文本”来增强输入。</p> <p>如需设置指定帮助文本的样式,请使用 .input-group-text 类:</p> <form action="/demo/html/action_page.php"> <div class="input-group mb-3"> <span class="input-group-text">@</span> <input type="text" class="form-control" placeholder="用户名" name="usrname"> </div> <div class="input-group mb-3"> <input type="text" class="form-control" placeholder="您的电邮" name="email"> <span class="input-group-text">@example.com</span> </div> <button type="submit" class="btn btn-primary">提交</button> </form> </div> </body> </html>