2017-09-26 68 views
0

我从getbootstrap.com下载了bootstrap 4.0 beta,我包含了dist文件夹中的CSS & js,但是我的样式不完整(导航栏,隐藏,可见不工作)是否需要任何额外的东西来包含我的引导文件夹,(我需要sass文件夹)。 我包括我的CSS,js & jquery具有正确的路径。 任何人都可以帮我解答。为什么我的助推器4.0 beta工作不正常?

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <title>Bootstrap Example</title> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css"> 
</head> 
<body> 

<nav class="navbar navbar-inverse"> 
    <div class="container-fluid"> 
    <div class="navbar-header"> 
     <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar"> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span>       
     </button> 
     <a class="navbar-brand" href="#">WebSiteName</a> 
    </div> 
    <div class="collapse navbar-collapse" id="myNavbar"> 
     <ul class="nav navbar-nav"> 
     <li class="active"><a href="#">Home</a></li> 
     <li class="dropdown"> 
      <a class="dropdown-toggle" data-toggle="dropdown" href="#">Page 1 <span class="caret"></span></a> 
      <ul class="dropdown-menu"> 
      <li><a href="#">Page 1-1</a></li> 
      <li><a href="#">Page 1-2</a></li> 
      <li><a href="#">Page 1-3</a></li> 
      </ul> 
     </li> 
     <li><a href="#">Page 2</a></li> 
     <li><a href="#">Page 3</a></li> 
     </ul> 
     <ul class="nav navbar-nav navbar-right"> 
     <li><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li> 
     <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li> 
     </ul> 
    </div> 
    </div> 
</nav> 

<div class="container"> 
    <h3>Collapsible Navbar</h3> 
    <p>In this example, the navigation bar is hidden on small screens and replaced by a button in the top right corner (try to re-size this window). 
    <p>Only when the button is clicked, the navigation bar will be displayed.</p> 
</div> 
</body> 
</html> 
+1

你能提供一个最小的,可重复的例子吗? –

+0

只要你不需要BS的js部分,这应该工作得很好。控制台中是否有错误? – Aslam

+0

网格系统工作正常,但navgation和其他一些类不支持 – Lohith

回答

0

你提到你下载了Bootstrap 4.0 beta,所以我假设你正在尝试使用文件路径来使用它。你不需要下载SASS。如果你真的不需要它的所有功能,那么你可以按照Bootstraps的快速入门指南,https://getbootstrap.com/docs/4.0/getting-started/introduction/

<!DOCTYPE html> 
    <html lang="en"> 
     <head> 
     <!-- Required meta tags --> 
     <meta charset="utf-8"> 
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> 

     <!-- Bootstrap CSS --> 
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"> 
     </head> 
     <body> 
     <h1>Hello, world!</h1> 

     <!-- Optional JavaScript --> 
     <!-- jQuery first, then Popper.js, then Bootstrap JS --> 
     <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> 
     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script> 
     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script> 
     </body> 
    </html> 

为了让你开始,试试看。然后,也许以后你可以选择特定的组件。

+0

使用CDN它工作正常,但我不想在服务器存储引导,我想本地下载和IAM通过链接和脚本标记与确切的路径导入CSS,JS和jQuery文件。是否使用文件路径 – Lohith

+0

错误问题是您正在使用Bootstrap 3.x.x版本。 Bootstrap用4.0 beta对他们的框架进行了彻底的改革;例如,你仍在使用图形,但他们已经删除了这个组件。使用您的导航栏的当前文档。以下是有关更改的更多信息