8

我的导航栏和 bootstrap 3 中的 jumbotron 之间有空间。jumbotron 和 3 个水平缩略图之间也有空间。我想摆脱这个空间。我是否必须更改 CSS 并更改填充或最好的方法是什么?

_标题

<nav class="navbar navbar-inverse" role="navigation">
  <!-- Brand and toggle get grouped for better mobile display -->
  <div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
      <span class="sr-only">Toggle navigation</span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </button>
    <div style="font-family:Webdings;">
      <%= link_to "Project", root_path, class: 'navbar-brand' %>
    </div>
  </div>

  <!-- Collect the nav links, forms, and other content for toggling -->
  <div class="collapse navbar-collapse navbar-ex1-collapse">
    <ul class="nav navbar-nav">
      <li class="active"><%= link_to "About", about_path %></li>
      <li><%= link_to "Team", team_path %></li>
      <li class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Resources<b class="caret"></b></a>
        <ul class="dropdown-menu">
          <li><%= link_to "Action 1", about_path %></li>
          <li><%= link_to "Action 2", about_path %></li>
          <li><%= link_to "Action 3", about_path %></li>
          <li><%= link_to "Action 4", about_path %></li>
        </ul>
      </li>
    </ul>
    <ul class="nav navbar-nav navbar-right">
      <li><%= link_to "Contact", contact_path %></li>
      <li><%= link_to "Sign Up", register_path %></li>
    </ul>
  </div><!-- /.navbar-collapse -->
</nav

主页(带缩略图)

<%= provide(:title, "Home") %>
<div class="jumbotron">
  <div class="container">
    <h1>Welcome to club!</h1>
    <p>blabla</p>
    <p><a class="btn btn-primary btn-lg">Sign Up</a></p>
  </div>
</div>


<div class="column">
  <div class="col-xs-4">
    <div class="thumbnail">
      <img src="http://b2bleadblog.com/images/2007/05/18/huddlehands.jpg" alt="My Image" />
      <div class="caption">
        <h3>Blablabla</h3>
        <p style="font-size:17px">Blablalbal.</p>
      </div>
    </div>
  </div>
</div>
4

3 回答 3

22

你必须设置margin-bottom:0;navbarjumbotron。您可以使用自定义样式表来覆盖它。在引导 css 参考旁边使用自定义 CSS。如下:

  <link href="../css/bootstrap.css" rel="stylesheet" type="text/css" /> 
  <link href="../css/CustomStyles.css" rel="stylesheet" type="text/css" />

请参阅此引导示例

于 2013-08-27T05:28:58.850 回答
-1

删除 jumbotron 和 navbar 之间空间的一种方法是更改​​您的行:

<div class="navbar navbar-default">

进入:

<div class="navbar navbar-default navbar-fixed-top">
于 2019-01-31T19:33:47.823 回答
-5

有时问题是 HTML 中的额外空间,请尝试:

<div class="jumbotron">
    ...
    <p><a class="btn btn-primary btn-lg">Sign Up</a></p>
  </div>
</div>
<div class="column">
  <div class="col-xs-4">
    ...
</div>

请注意,我\n在 div 之间删除了两个。

于 2013-08-23T19:51:37.480 回答