7.5.2 导航两端对齐
如果要实现两端对齐的导航,则只要为导航的<ul>
或<ol>
元素增加.nav-justified
样式即可,这样导航将会自动占满父容器并且两端对齐。
程序示例
例如如下代码。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| <!DOCTYPE html> <html>
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <title> 两端对齐的导航 </title> <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="../bootstrap/css/bootstrap-theme.min.css"> </head>
<body> <div class="container"> <ul class="nav nav-tabs nav-justified"> <li role="presentation"><a href="#">主页</a></li> <li role="presentation"><a href="#">课程体系</a></li> <li role="presentation" class="active"><a href="#">师资介绍</a></li> <li role="presentation"><a href="#">教育理念</a></li> <li role="presentation" class="disabled"><a href="#">退出系统</a></li> </ul> <hr> <ul class="nav nav-pills nav-justified"> <li role="presentation"><a href="#">主页</a></li> <li role="presentation"><a href="#">课程体系</a></li> <li role="presentation" class="active"><a href="#">师资介绍</a></li> <li role="presentation"><a href="#">教育理念</a></li> <li role="presentation" class="disabled"><a href="#">退出系统</a></li> </ul> </div> <script type="text/javascript" src="../jquery-3.1.1.js"></script> <script type="text/javascript" src="../bootstrap/js/bootstrap.min.js"></script> </body>
</html>
|