【问题标题】:container in bootstrap is not working引导程序中的容器不起作用
【发布时间】:2018-06-27 10:01:08
【问题描述】:

在 bootstrap 3.3.6 版本的 dist 文件夹中,我有一个 index.html 文件,其中包含以下代码,但这些代码不起作用。使用 bootstrap 文件夹,我们有 cs、js、font 文件夹和 index.html

<!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 -->
  <title>Bootstrap 101 Template</title>

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

  <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
  <!--script src="https://ajax.googleapis.com/ajax/libs/jquery/jquery.min.js"></script-->
  <script src="js/jquery/jquery.min.js"></script>
  <!-- Include all compiled plugins (below), or include individual files as needed -->
  <script src="js/bootstrap.min.js"></script>
</head>

<body>
  <!--h1 class="text-primary">Hello, world!</h1-->
  <div class="container">
    <div class="row">
      <div class="col-mid-4">Left Side </div>
      <div class="col-mid-4">Middle</div>
      <div class="col-mid-4">Left Side </div>
    </div>

  </div>


</body>

</html>

【问题讨论】:

  • 请检查css路径是否有问题

标签: jquery html css twitter-bootstrap twitter-bootstrap-3


【解决方案1】:

使用col-md-* 而不是mid

<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="js/jquery/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<div class="container">
  <div class="row">
     <div class="col-md-4">Left Side </div>
     <div class="col-md-4">Middle</div>
     <div class="col-md-4">Left Side </div>
   </div>
</div>

【讨论】:

    【解决方案2】:

    解决办法如下:

    <!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 -->
      <title>Bootstrap 101 Template</title>
    
      <!-- Bootstrap -->
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    
    <!-- jQuery library -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    
    <!-- Latest compiled JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script></head>
    
    <body>
      <!--h1 class="text-primary">Hello, world!</h1-->
      <div class="container">
        <div class="row">
          <div class="col-xs-4 col-md-4 col-sm-4 col-lg-4">Left Side </div>
          <div class="col-xs-4 col-md-4  col-sm-4 col-lg-4">Middle</div>
          <div class="col-xs-4 col-md-4 col-sm-4 col-lg-4">Left Side </div>
        </div>
    
      </div>
    
    
    </body>
    
    </html>
    

    检查这个:https://jsfiddle.net/x4qapovk/3/

    【讨论】:

      猜你喜欢
      • 2014-06-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多