Foundation Chinese Manual
/ Foundation 侧边栏
Foundation 侧边栏
侧边栏导航
Foundation 使用 <ul class="side-nav">
创建侧边栏:
实例
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body> <ul class="side-nav"> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> <li><a href="#">Link 4</a></li> </ul> <div style="padding:20px;"> <h3>侧栏导航</h3> <p> .side-nav 类用于创建侧栏导航,宽度为父元素100%宽度。</p> </div> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例
激活链接与分割线
已点击的链接可以在 <li>
上使用 .active
类来标识,使用 .divider
类添加水平分割线:
实例
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body> <ul class="side-nav"> <li class="active"><a class="a" href="#">Link 1</a></li> <li><a class="a" href="#">Link 2</a></li> <li class="divider"></li> <li><a class="a" href="#">Link 3</a></li> <li><a class="a" href="#">Link 4</a></li> </ul> <div style="padding:20px;"> <h3>侧栏导航</h3> <p> .active 类用于设置当期页链接。</p> <p> .divider 类用于设置水平的分割线。</p> </div> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例
网格中的侧边栏
我们可以使用网格设计模式来设置侧边导航栏,实例如下:
实例
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body> <div class="row"> <div class="medium-4 columns" style="background-color:#f1f1f1;"> <ul class="side-nav"> <li class="active"><a href="#">Home</a></li> <li><a href="#">Learn HTML</a></li> <li><a href="#">Learn JavaScript</a></li> <li><a href="#">Learn CSS</a></li> <li><a href="#">Learn Foundation</a></li> <li><a href="#">Learn HTML</a></li> <li><a href="#">Learn JavaScript</a></li> <li><a href="#">Learn CSS</a></li> <li><a href="#">Learn Foundation</a></li> </ul> </div> <div class="medium-8 columns"> <h1>侧栏导航</h1> <p>该实例将侧栏导航房子网格设计中,背景为灰色。</p> <p><strong>注意:</strong> 在小屏幕尺寸上,侧栏导航是垂直的,且宽度是延展到整个屏幕(100% width)。</p> <p>重置浏览器查看效果。</p> <p>行为动作可以通过 javascript 或媒体查询来修改它。</p> </div> </div> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例