要使用Bootstrap创建选项卡,请使用.nav和.nav-tabs类。使用.dropdown-menu类。
从基本无序列表开始,其基类为.nav
添加类.nav-tabs。
现在添加一个带有.dropdown-menu类的无序列表。
您可以尝试运行以下代码来创建带有下拉菜单的标签页-
<!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 style = "background: #FADBD8;"> <h2>Website</h2> <ul class = "nav nav-tabs"> <li class = "active"><a href = "#">Home</a></li> <li><a href = "#">About</a></li> <li class = "dropdown"> <a class = "dropdown-toggle" data-toggle = "dropdown" href = "#"> Products <span class = "caret"></span> </a> <ul class = "dropdown-menu"> <li><a href = "#">Online Compiler</a></li> <li><a href = "#">Image Editor</a></li> <li><a href = "#">Document Viewer</a></li> </ul> </li> <li><a href = "#">Services</a></li> <li><a href = "#">Contact</a></li> </ul> </body> </html>