Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 溢出jumbotron后台img至导航栏_Javascript_Jquery_Html_Css_Twitter Bootstrap - Fatal编程技术网

Javascript 溢出jumbotron后台img至导航栏

Javascript 溢出jumbotron后台img至导航栏,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,我正试图将jumbotronbackground溢出到navbar中,这样我就可以进行此操作,请参见我的示例 我已经开始尝试溢出,但不知怎的,我发现我不需要它,我只是删除了导航栏类导航栏反向,就是这样,图像只是溢出了导航栏,但是,这在jsfiddle上起作用,但在我的本地index.html上不起作用,理解发生了什么对我来说真的很困惑,所以有人可以检查我的代码并向我解释为什么这个示例在jsfiddle上工作,而不是在我的本地项目中工作 Index.html和main.css /* Move do

我正试图将
jumbotron
background
溢出到
navbar
中,这样我就可以进行此操作,请参见我的示例

我已经开始尝试
溢出
,但不知怎的,我发现我不需要它,我只是删除了
导航栏
导航栏反向
,就是这样,图像只是溢出了
导航栏
,但是,这在
jsfiddle
上起作用,但在我的本地
index.html
上不起作用,理解发生了什么对我来说真的很困惑,所以有人可以检查我的代码并向我解释为什么这个示例在
jsfiddle
上工作,而不是在我的本地项目中工作

Index.html和main.css

/* Move down content because we have a fixed navbar that is 50px tall */
body {
  padding-top: 50px;
  padding-bottom: 20px;
}

.jumbotron {
  background: url('http://lorempixel.com/1024/980/city') no-repeat;
  background-size: cover;
  height: 500px;
}


<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>Cover Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="bower/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="../../assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="bower/bootstrap/dist/css/cover.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="../../assets/js/ie-emulation-modes-warning.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>

    <nav class="navbar navbar-fixed-top">
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <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="#">Project name</a>
            </div>
            <div id="navbar" class="navbar-collapse collapse">
              <form class="navbar-form navbar-right">
                <div class="form-group">
                  <input type="text" placeholder="Email" class="form-control">
                </div>
                <div class="form-group">
                  <input type="password" placeholder="Password" class="form-control">
                </div>
                <button type="submit" class="btn btn-success">Sign in</button>
              </form>
            </div><!--/.navbar-collapse -->
          </div>
        </nav>

        <!-- Main jumbotron for a primary marketing message or call to action -->
        <div class="jumbotron">
          <div class="container">
            <h1>Hello, world!</h1>
            <p>This is a template for a simple marketing or informational website. It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
            <p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more &raquo;</a></p>
          </div>
        </div>

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="bower/jquery/dist/jquery.min.js"><\/script>')</script>
    <script src="bower/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
  </body>
</html>
/*向下移动内容,因为我们有一个50像素高的固定导航栏*/
身体{
填充顶部:50px;
垫底:20px;
}
琼伯伦先生{
背景:url('http://lorempixel.com/1024/980/city")不重复;;
背景尺寸:封面;
高度:500px;
}
引导程序的封面模板
切换导航
登录
你好,世界!
这是一个简单的营销或信息网站的模板。它包括一个称为jumbotron的大型标注和三个支持内容。把它作为一个起点来创造更独特的东西

window.jQuery | | document.write(“”)
我刚刚意识到我需要移除
填充顶部:50px
正文
就是这样。

如果您从引导程序网站上查看,您会看到它下载了一个名为jumbotron.css的特定文件,以应用您拥有的确切样式。其内容:

/* Move down content because we have a fixed navbar that is 50px tall */
body {
  padding-top: 50px;
  padding-bottom: 20px;
}