进度条将不会显示

时间:2018-03-10 14:52:55

标签: javascript css twitter-bootstrap

我只是想在我的页面中添加一个进度条,我甚至无法显示它!我把网站剥离到最低限度,试图找出可能但却无法解决的问题!我以为这是我创建的自定义css文件,但我删除了它,问题仍然存在。

<!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 -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <title>STEMuli Explore</title>
</head>

<body>
  <div class="row h-100 justify-content-center">
    <a name="redirectHome" onClick="redirectHome()"><img src="/img/logo.png" class="img-fluid" width="100" height="100" alt="Responsive image">
    </a>
  </div>
  <div class="container-fluid">
    <div class="row align-items-center">
      <div class="col-6">
        <a href="#" name="redirectCreate" onClick="redirectCreate()">
          <h1 class="text-center">
              Create</h1>
        </a>
      </div>
      <div class="col-6 text-center">
        <a href="#" name="redirectExplore" onClick="redirectExplore()">
          <h1 class="text-center">
              Explore</h1>
        </a>
      </div>
    </div>
    <div class="row h-100 justify-content-center">
      <div class="progress">
  <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
  <div class="progress-bar" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
  <div class="progress-bar" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
  <div class="progress-bar" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
  <div class="progress-bar" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
    </div>
  </div>
  <!-- Optional JavaScript -->
  <!-- jQuery first, then Popper.js, then Bootstrap JS -->
  <script type="text/javascript" src="/js/redirect.js"></script>
  <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.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
  <!--Logical JS files-->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  
</body>

</html>

3 个答案:

答案 0 :(得分:2)

从包含进度条的父div中删除类row

<!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 -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <title>STEMuli Explore</title>
</head>

<body>
  <div class="row h-100 justify-content-center">
    <a name="redirectHome" onClick="redirectHome()"><img src="/img/logo.png" class="img-fluid" width="100" height="100" alt="Responsive image">
    </a>
  </div>
  <div class="container-fluid">
    <div class="row align-items-center">
      <div class="col-6">
        <a href="#" name="redirectCreate" onClick="redirectCreate()">
          <h1 class="text-center">
            Create</h1>
        </a>
      </div>
      <div class="col-6 text-center">
        <a href="#" name="redirectExplore" onClick="redirectExplore()">
          <h1 class="text-center">
            Explore</h1>
        </a>
      </div>
    </div>
    <div class="h-100 justify-content-center">
      <div class="progress">
        <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
      </div>
      <div class="progress">
        <div class="progress-bar" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
      </div>
      <div class="progress">
        <div class="progress-bar" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
      </div>
      <div class="progress">
        <div class="progress-bar" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
      </div>
      <div class="progress">
        <div class="progress-bar" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
      </div>
    </div>
  </div>
  <!-- Optional JavaScript -->
  <!-- jQuery first, then Popper.js, then Bootstrap JS -->
  <script type="text/javascript" src="/js/redirect.js"></script>
  <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.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
  <!--Logical JS files-->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

</body>

</html>

答案 1 :(得分:1)

这可能是由于对Bootstrap 4网格系统工作方式的误解。

以下是解决此特定问题的一些提示,以及未来的问题。

请参阅下面的代码段,其中有效:

  1. 我建议您read the Bootstrap 4 grid docs,您会发现这一切都基于flex,因此您需要删除.row,添加.col或进行其他更改得到你想要的布局。
  2. 在下面的工作片段中,您会注意到我在进度条上添加了“边框”样式。这是一种故障排除技术,可以立即向您显示正在发生的事情(当我对您的代码执行操作时,所有进度条都很小,彼此水平紧密堆叠)。
  3. 在下面的代码段中,我戏剧性地简化了代码。这是一种隔离问题的做法 - 简化直到它只是一个问题/项目,解决它,然后你可以把它烧成你的大图计划。
  4. 利用浏览器的开发人员工具并检查元素。这样做会显示有关正在发生的事情。它是任何Web开发人员工具包中必不可少的工具,因此要学习它,掌握它。这是你的朋友!
  5. .progress {
      border: 1px solid red;
    }
    
    .progress-bar {
      border: 2px solid black;
    }
    <!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 -->
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
      <title>STEMuli Explore</title>
    </head>
    
    <body>
      <div class="container">
        <div>Borders added to illustrate a troubleshooting technique</div>
        <div class="row h-100 justify-content-center">
          <div class="col">
            <div class="progress">
              <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="col">
            <div class="progress">
              <div class="progress-bar" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
            </div>
          </div>
        </div>
      </div>
    
      <!-- Optional JavaScript -->
      <!-- jQuery first, then Popper.js, then Bootstrap JS -->
      <script type="text/javascript" src="/js/redirect.js"></script>
      <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.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
      <!--Logical JS files-->
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    
    </body>
    
    </html>

答案 2 :(得分:0)

包含div类const,const可能需要一个块状内容。我对bootstrap4不太熟悉,但是在bootstrap3中,有printf "Index Updater\n" fswatch -o ./backend/src/static/index.html | while read num ; \ do \ DATE=`date '+%Y-%m-%d %H:%M:%S'` printf "Copy updated index.html => ang_home.html @${DATE} \n" cp ./backend/src/static/index.html ./backend/src/templates/ang_home.html done 这个概念......用div row h-100或其他东西包装进度条?

col-md-12

ps col-lg <div class="row h-100 justify-content-center"> <div class = "col-lg"> <div class="progress"> <div class="progress-bar" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> </div> </div> </div> ctrl是你的朋友