使用.active类将灰色背景色添加到Bootstrap列表组中的活动列表项中。
您可以尝试运行以下代码将背景色添加到活动列表项中-
<!DOCTYPE html> <html> <head> <title>Bootstrap Example</title> <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet"> <script src = "/scripts/jquery.min.js"></script> <script src = "/bootstrap/js/bootstrap.min.js"></script> </head> <body> <div class = "container"> <h2>Features of Java</h2> <div class = "list-group"> <a href = "#" class="list-group-item active">Interface</a> <a href = "#" class="list-group-item">Multi-threading</a> <a href = "#" class="list-group-item">Packages</a> <a href = "#" class="list-group-item">Collection</a> <a href = "#" class="list-group-item">Serialization</a> </div> </div> </body> </html>