[Bootstrap]组件(四)

导航条

挪动装备及折(可开关),超过规定视口标签上水平进行模式 依赖插件

注意点:导航条内元素过多或者另原因导致元素内元素宽度过长,会挑起折行–>解决:a.减少导航内元素或者缩减宽度
 b.利用媒体询问或者响应工具类隐藏元素
 c.修改媒体询问的价值或者重置覆盖媒体询问的价

注意点:<nav>元素 || <div role=”navigation”></div>

/*
 * 1 nav(.navbar.navbar-*:基类+状态类)(div元素需要额外添加role="navigation")
 * 2 div(.container-fluid:响应式容器)
 * 3 div(.navbar-header:导航条头部) + div(.collapse.navbar-collapse:折叠类+导航折叠类)
 * 3.1 导航条头部 内部:btn(.navbar-toggle.collapsed:导航开关类+被折叠类)+a(.navbar-brand:导航条商标类)
 * 3.2 折叠类+导航折叠类 内部:ul(.nav.navbar-nav:导航基类+导航条导航类)+(表单)
 */

<nav class="navbar navbar-default">  <!--  nav元素/div元素添加role="navigation" 基类.navbar 状态类.navbar-default  -->
  <div class="container-fluid">  <!-- 容器.container-fluid 响应式容器 -->
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">  <!-- 导航条头部 内容包括折叠按钮和logo/商标 -->
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">  <!--导航条中的折叠按钮-->
        Toggle navigation



      </button>
      <a class="navbar-brand" href="#">Brand</a>  <!-- 导航条logo/商标 -->
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">  <!-- 导航条的主要内容 可包含导航链接/表单/其他内容 在媒体查询的规定宽度下可折叠开关 -->
      <ul class="nav navbar-nav"> <!-- 导航 导航条下的导航 -->
        <li class="active"><a href="#">Link (current)</a></li>
        <li><a href="#">Link</a></li>
        <li class="dropdown">  <!-- 下拉菜单 -->
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown </a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="#">Separated link</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="#">One more separated link</a></li>
          </ul>
        </li>
      </ul>
      <form class="navbar-form navbar-left" role="search">  <!-- 导航条下的表单 -->
        <div class="form-group"> <!-- 表单组 -->
          <input type="text" class="form-control" placeholder="Search">
        </div>
        <button type="submit" class="btn btn-default">Submit</button>
      </form>
      <ul class="nav navbar-nav navbar-right"> <!-- 导航 导航条下的导航 导航想右对齐 -->
        <li><a href="#">Link</a></li>
        <li class="dropdown">  <!-- 下拉菜单 -->
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown </a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="#">Separated link</a></li>
          </ul>
        </li>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

 

导航久被的品牌图标

.navbar-brand类中放置img元素,即可安装好的商标,根据需要改css或埋css

<nav class="navbar navbar-default">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="">
        <img src="..."/>
      </a>
    </div>
  </div>
</nav>

 

导航长被的表单

<form class="navbar-form" role="search">
  <div class="form-group">
    <input type="text" class="form-control" placeholder="search" />
  </div>
  <button type="submit" class="btn btn-default">submit</button>
</form>

 

导航漫长中之按钮

<button type="button" class="btn btn-default navbar-btn">button</button>

 

导航漫漫受的文件

<p class="navbar-text">navbar-text</p>

 

非导航的链接

<p class="navbar-text navbar-right">Signed in as <a href="#" class="navbar-link">Mark Otto</a></p>

 

组件排列

.navbar-left/.navbar-right –>导航链接/表单/按钮/文本对合

最终一个.navbar-right装了负边距,最好不用用几近只.navbar-right

 

导航长条稳定在顶部

.navbar-fixed-top
固定的领航漫长引起遮挡body内部任何的音,可能要对其增长内补等额外样式

<nav class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    ...
  </div>
</nav>

 

导航条静止在顶部

.navbar-static-top 不需要为body设置内补

<nav class="navbar navbar-default navbar-static-top">
  <div class="container">
    ...
  </div>
</nav>

 

路线导航

面包屑.breadcrumb
 {padding/margin-bottom/list-style/background-color/border-radius}

<ol class="breadcrumb">
  <li><a href="#">Home</a></li>
  <li><a href="#">Library</a></li>
  <li class="active">Data</li>
</ol>

 

分页

nav>ul.pagination>li>a

<nav>
  <ul class="pagination">
    <li>
      <a href="#" aria-label="Previous">
        &laquo;
      </a>
    </li>
    <li><a href="#">1</a></li>
    <li><a href="#">2</a></li>
    <li><a href="#">3</a></li>
    <li><a href="#">4</a></li>
    <li><a href="#">5</a></li>
    <li>
      <a href="#" aria-label="Next">
        &raquo;
      </a>
    </li>
  </ul>
</nav>

 

分页禁止与激活状态

禁止.disabled/激活.active

<nav>
  <ul class="pagination">
    <li class="disabled"><a href="#" aria-label="Previous">&laquo;</a></li>
    <li class="active"><a href="#">1 (current)</a></li>
    ...
  </ul>
</nav>

 

翻页

nav>ul.pager>li*2>a

<nav>
  <ul class="pager">
    <li><a href="#">Previous</a></li>
    <li><a href="#">Next</a></li>
  </ul>
</nav>

 

翻页两端对旅

nav>ul.pager>(li.previous>a)+(li.next>a)

<nav>
  <ul class="pager">
    <li class="previous"><a href="#">&larr; Older</a></li>
    <li class="next"><a href="#">Newer &rarr;</a></li>
  </ul>
</nav>

 

相关文章