bootstrap组件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Mccree1997/article/details/77478766

输入框组

这里写图片描述

添加一个span,设置类为input-group-addon

<div class="input-group">
  <span class="input-group-addon" id="basic-addon1">@</span>
  <input type="text" class="form-control" placeholder="Write down your fucking Username" aria-describedby="basic-addon1">
</div>

//password部分

<div class="input-group">
    <input type="text" class="form-control" placeholder="Write down your fucking Password" aria-describedby="basic-addon2">
    <span class="input-group-addon" id="basic-addon2">Password</span>

  </div>

不光是可以添加文字,还能在span中添加多选框单选框什么的;但如果想要添加额外元素的按钮就要使用input-group-btn 类;

<div class="input-group">
  <input type="text" class="form-control" placeholder="Write down your fucking Username" aria-describedby="basic-addon1">
  <span class="input-group-btn" id="basic-addon1">
    <button class="btn btn-default" type="button">开始哲↑学</button>
  </span>
</div>

导航部分

bootstrap所有的导航组件都依赖同一个nav 类,状态类也是共用的

标签页: nav-tabs nav-pills nav-stacked 类,
nav-tabs
这里写图片描述
nav-pills
这里写图片描述
nav-stacked
这里写图片描述

我们呢可以在这三种里面添加下拉菜单

<ul class="nav nav-tabs">
    <li><a href="#">首页</a></li>
    <li class="dropdown">
        <a class="drop-toggle" data-toggle="dropdown">
        点击试试
        <span class="caret"></span>
        </a>
        <ul class="dropdown-menu">
            <li>你看见了吗</li>
        </ul>
    </li>
</ul>

导航条属性navbar

v3中文文档中给出了一个navbar的例子

<nav class="navbar navbar-default">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">Brand</a>
    </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 <span class="sr-only">(current)</span></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 <span class="caret"></span></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">
        <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 <span class="caret"></span></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>

首先,我们需要给nav设置navbar navbar-default 类,将导航设置为默认,b并加上role="navigation" 属性兼容,之后建立一个div,设置container-fluid 将导航条width=100%,之后导航分为了四个部分nav-header nav-collapse nav-left nav-right 分别设置导航条中四个部分的内容

固定在顶部和底部 bootstrap提供了navbar-fixed-top navbar-fixed-bottom 让导航条固定在顶部或底部

导航条的反色: navbar-inverse

路径导航:breadcrumb

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

分页组件

默认分页类 pagination 类 可以加上pagination-lg/sm 来设置尺寸

<ul class="pagination">
    <li>
      <a href="#">
        <span>&laquo;</span>
      </a>
    </li>
    <li><a href="#">1</a></li>
    <li><a href="#">2</a></li>
    <li>
      <a href="#">
        <span>&raquo;</span>
      </a>
    </li>
  </ul>

翻页类:pager 类会变成翻页图标 加上previous next 会两端对齐

阅读更多
换一批

没有更多推荐了,返回首页