为什么我的引导程序类不起作用?

时间:2018-07-04 17:36:32

标签: html5 netbeans twitter-bootstrap-3

我找不到我做错了什么。语法看起来还不错,但是每次我从引导程序调用类时,Netbeans都会显示错误。我的设置有问题吗?帮助。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Login</title>
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script src="//ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

</head>

<body style=" background-image : url('2.png'); background-repeat: repeat;">
    <div class="container-fluid">
        <div class="row align-items-center">
            <div class="col-12">
                <img src="logo_final.png" alt="logo" style="width:100px; height:100px; margin-left: 45%;"><br/> <br/>
                    </div>
                </div>
            </div>

2 个答案:

答案 0 :(得分:1)

在浏览器中选中https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css链接,找到col-12类。它不存在,因此无法正常工作。

您可以使用以下代码段将col-12替换为col-lg-12,将align-items-center替换为text-center。它正在以下代码段中运行。

<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title>Login</title>
  <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  <script src="//ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

</head>

<body style=" background-image : url('2.png'); background-repeat: repeat;">
  <div class="container-fluid">
    <div class="row">
      <div class="col-lg-12 text-center">
        <img src="https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg?sz=48" alt="logo" style="width:100px; height:100px;"><br/> <br/>
      </div>
    </div>
  </div>
</body>

答案 1 :(得分:0)

尝试更改此设置

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
 <script src="//ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

对此

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>