使用 Bootstrap 在单行中组合按钮
在 Bootstrap 中使用 .btn-group 类在单行中组合按钮。
你可以尝试运行以下代码在 Bootstrap 中实现 .btn-group 类
示例
<!DOCTYPE html> <html> <head> <title>Bootstrap Example</title> <link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"> <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src = "https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> </head> <body> <p>The following are the car brands:</p> <div class = "btn-group"> <button type = "button" class = "btn btn-default">BMW</button> <button type = "button" class = "btn btn-default">Audi</button> <button type = "button" class = "btn btn-default">Jeep</button> <button type = "button" class = "btn btn-default">Datsun</button> <button type = "button" class = "btn btn-default">Toyota</button> <button type = "button" class = "btn btn-default">Mahindra</button> </div> </body> </html>
广告