【问题标题】:How to use bootstrap without online link?如何在没有在线链接的情况下使用引导程序?
【发布时间】:2017-06-10 05:56:08
【问题描述】:

如何在没有这些链接“https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css”的情况下使用引导程序

我已经下载了 bootstrap.min.css 文件,我在 localhost 上使用了这个 class="glyphicon glyphicon-search" 但这不起作用并且没有在他们的网站上显示搜索图标。

【问题讨论】:

标签: html css


【解决方案1】:

发生这种情况是因为您的浏览器正在您计算机上的文件夹中查找字形图标。如果您从 CDN 加载引导程序,则字形图标与 CSS 文件相关联。下面的例子...

从这里下载引导程序:http://getbootstrap.com/getting-started/#download

来自外部引导文件的示例:

@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);

您可以将字体路径更改为绝对路径,下载字体并放置在正确的文件夹中,或下载正确的引导文件(不是 CDN)。

【讨论】:

    【解决方案2】:

    首先将 bootstrap.min.css 文件复制到项目文件夹中,然后将此代码放入 html 文件的 head 部分

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

    【讨论】:

      【解决方案3】:

      如果你的文件夹结构是这样的:

      |-- index.html
      |-- style
          |-- bootstrap.min.css
      

      然后您需要在 index.html 文件的部分中调用它。像这样:

      <head>
        <!-- Other stuff will likely be in here... -->
        <link href="/style/bootstrap.min.css" rel="stylesheet" />
      </head>
      

      如果您已最小化 javascript 文件,您需要将它们放在部分末尾的标记中,如下所示:

      <body>
          <!-- Other stuff will likely be in here... --> 
          <!-- Assume you have a directory named js at the same level as your HTML file -->
          <script src="js/main.min.js"></script>
      </body>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-10-05
        • 2015-08-01
        • 2012-03-15
        • 2022-01-10
        • 2017-02-23
        • 1970-01-01
        • 2018-01-07
        • 1970-01-01
        相关资源
        最近更新 更多