如何找到css和js文件的地址?

时间:2013-06-01 21:55:55

标签: html css twitter-bootstrap

我确信这是一个非常简单的问题,但我是一个菜鸟,无法弄明白。我正在尝试使用Twitter-Bootstrap初学者模板来帮助自己学习HTMLCSSJS。我将源代码复制并粘贴到TextWrangler中并在Firefox中打开html文件。没有引导功能。

我几乎可以肯定这是因为需要更改像<link href="../assets/css/bootstrap.css" rel="stylesheet">这样的行来反映我自己计算机上的css / js文件的地址。如果这是问题,我该怎么做?

以下是源代码:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Bootstrap, from Twitter</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="../assets/css/bootstrap.css" rel="stylesheet">
    <style>
      body {
        padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
      }
    </style>
    <link href="../assets/css/bootstrap-responsive.css" rel="stylesheet">

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="../assets/js/html5shiv.js"></script>
    <![endif]-->

    <!-- Fav and touch icons -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
      <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
                    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
                                   <link rel="shortcut icon" href="../assets/ico/favicon.png">
  </head>

  <body>

    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="brand" href="#">Project name</a>
          <div class="nav-collapse collapse">
            <ul class="nav">
              <li class="active"><a href="#">Home</a></li>
              <li><a href="#about">About</a></li>
              <li><a href="#contact">Contact</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

    <div class="container">

      <h1>Bootstrap starter template</h1>
      <p>Use this document as a way to quick start any new project.<br> All you get is this message and a barebones HTML document.</p>

    </div> <!-- /container -->

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="../assets/js/jquery.js"></script>
    <script src="../assets/js/bootstrap-transition.js"></script>
    <script src="../assets/js/bootstrap-alert.js"></script>
    <script src="../assets/js/bootstrap-modal.js"></script>
    <script src="../assets/js/bootstrap-dropdown.js"></script>
    <script src="../assets/js/bootstrap-scrollspy.js"></script>
    <script src="../assets/js/bootstrap-tab.js"></script>
    <script src="../assets/js/bootstrap-tooltip.js"></script>
    <script src="../assets/js/bootstrap-popover.js"></script>
    <script src="../assets/js/bootstrap-button.js"></script>
    <script src="../assets/js/bootstrap-collapse.js"></script>
    <script src="../assets/js/bootstrap-carousel.js"></script>
    <script src="../assets/js/bootstrap-typeahead.js"></script>

  </body>
</html>

1 个答案:

答案 0 :(得分:1)

你的假设是正确的,因为<link href="../assets/css/bootstrap.css" rel="stylesheet">行。

此行是对css文件的引用。您需要做的是将引导程序文件保存到某个文件夹中的计算机上。

要执行此操作,请从http://twitter.github.io/bootstrap/下载引导程序,然后将css,img和js文件夹复制到您的文件夹中。

现在,在TextWrangler的文件中,将href属性更改为“css / bootstrap.css”,它将显示为<link href="css/bootstrap.css" rel="stylesheet">

现在将您的文件保存为index.html,与您复制的其他文件夹位于同一目录中。

您需要对所有其他引用执行相同的操作,例如<link href="../assets/css/bootstrap-responsive.css" rel="stylesheet">

您还会在底部看到一些JavaScript文件的引用。改变这些。

祝你好运!