增加我的导航栏大小/高度会导致我的引导程序全高列

时间:2016-12-30 20:15:14

标签: html css twitter-bootstrap

我想让我的引导导航栏更大(更大的按钮,更大的输入,高度等)但是在导航栏中将第一个元素设置为大(输入 - >输入-lg)后,它会破坏我的2列已满高度。它在页面上创建了我不想要的外部滚动。 我这里有bootply这里有一个导航栏和2列100%高度,你可以看到由于导航栏中的大输入而创建的外滚动条。如果我从导航栏中删除大输入,则导航栏会缩小,并且列会重新调整为完整高度,外部滚动会消失。

问题 - 引导程序导航栏是否有一个好的插件或库,可以让它们比标准尺寸更大并自定义它们?

这是我的代码

html,
body {
  height: 100%;
  /*border: 1px solid red;*/
}
.table-container {
  height: calc(100% - 53px);
  /*border: 1px solid green;*/
}
nav.navbar {
  margin: 0;
}
.table-container {
  display: block;
  width: 100%;
  padding-left: 0px;
  padding-right: 0px;
}
.table-container .table-row {
  height: 100%;
  display: block;
}
.table-container .table-row .table-col {
  display: block;
  float: left;
  vertical-align: top;
  height: 100%;
  /*overflow-y: scroll;*/
}
#eventsContainer,
#hostsContainer,
#teachersContainer {
  height: 100%;
  overflow-y: scroll;
  position: relative;
}
.table-row {
  margin: 0;
}
.resultBtn:focus {
  outline: none;
}
<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 class="form-control input-lg" placeholder="Search" type="text">
        </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>
<div class="container table-container">
  <div class="row table-row">
    <div class="col-sm-6 table-col">nav</div>
    <div class="col-sm-6 table-col" style="border: 1px solid red;">
      <div id="eventsContainer">
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-body">
            Basic panel example
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

1 个答案:

答案 0 :(得分:1)

在更改输入之前,.navbar的{​​{1}}为50px,min-height的身高为.table-container(这很好,并且导致了calc(100% - 53px);元素没有滚动。

现在您的输入较大(在<body>中) - 导航栏的.navbar实际上是height,如果您使用64px则不够,您的calc(100% - 53px)元素上会有一个滚动条。

如果您的高度为<body>,则会移除滚动条:

http://www.bootply.com/iX3kL0vmNW