引导网格未正确对齐

时间:2017-03-27 08:59:11

标签: html css twitter-bootstrap flask raspberry-pi3

我一直在制作一个简单的网页,在顶行显示三个图像,在底部显示三个图像。我甚至无法让这个测试页面正常工作。

我正在使用Raspberry Pi 3B运行Raspbian Jessie,使用烧瓶0.10.1。

以下是观点:

@app.route('/')
@app.route('/index')
def index():
    return render_template('index.html',
               title='testpage')`

和HTML模板:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!--link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.min.css"-->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  <!--script src="bootstrap-3.3.7-dist/js/jquery-3.2.0.min.js"></script-->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <!--script src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script-->
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
  <div class="container">
    <div class="row">

      <div class="col-xs-3-sm-3-md-3-lg-3">
        <h1>3 Cols here
        </h1>
      </div>  

      <div class="col-xs-3-sm-3-md-3-lg-3">
        <h1>3 Cols here
        </h1>
      </div>  

      <div class="col-xs-3-sm-3-md-3-lg-3">
        <h1>3 Cols here
        </h1>
      </div>  

      <div class="col-xs-3-sm-3-md-3-lg-3">
        <h1>3 Cols here
        </h1>
      </div>  
    </div>

    <div class="row">
      <div class="col-xs-12-sm-12-md-12-lg-12">
        <h1>1 Col here
        </h1>
      </div>
    </div>
  </div>
</body>
</html>

注意:我最初尝试在本地获取引导程序文件,因为Web服务器将在Intranet上运行,但是当它不起作用时,我将其注释掉并添加了CDN链接。

页面正确加载文本,但都在一个中心列中。似乎没有任何“网格”可言。有没有人有任何建议会出现什么问题?

1 个答案:

答案 0 :(得分:0)

define class中存在语法错误。它应该是这样的: col-xs-3 col-sm-3 col-md-3 col-lg-3

&#13;
&#13;
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!--link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.min.css"-->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  <!--script src="bootstrap-3.3.7-dist/js/jquery-3.2.0.min.js"></script-->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <!--script src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script-->
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
  <div class="container">
    <div class="row">

      <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
        <h1>3 Cols here
        </h1>
      </div>  

      <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
        <h1>3 Cols here
        </h1>
      </div>  

      <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
        <h1>3 Cols here
        </h1>
      </div>  

      <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
        <h1>3 Cols here
        </h1>
      </div>  
    </div>

    <div class="row">
      <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <h1>1 Col here
        </h1>
      </div>
    </div>
  </div>
</body>
</html>
&#13;
&#13;
&#13;

相关问题