【问题标题】:Bootstrap Glyphicons won't show unless all the files are in the root除非所有文件都在根目录中,否则引导 Glyphicons 不会显示
【发布时间】:2016-02-15 10:55:40
【问题描述】:

通过以下与 CSS/JS 的链接,我能够成功选择除 Glyphicons 之外的所有 CSS。

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="../bootstrap-3.3.5-dist/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="../bootstrap-3.3.5-dist/css/bootstrap-theme.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="../bootstrap-3.3.5-dist/bootstrap.min.js"></script>

项目文件夹结构:

-- bootstrap-3.3.5-dist
-- myProjectFolder -- index.html
                   -- aboutUs.html
                   -- ...html
                   -- ...html

What I want >>>:

我得到的却是:


然而,在将 HTML 文件移动到根目录后,一切正常,因此我在项目根目录上拥有 HTML 和引导程序。链接更改为:

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="bootstrap-3.3.5-dist/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href=".bootstrap-3.3.5-dist/css/bootstrap-theme.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>

项目文件夹结构现在更改为:

-- bootstrap-3.3.5-dist
-- index.html
-- aboutUs.html
-- ...html
-- ...html

为什么会这样,有没有办法在不将 HTML 文件移动到根目录的情况下使其全部工作?

【问题讨论】:

  • 每个浏览器都有这个问题吗?
  • 您必须参考 相对于索引文件的引导文件。因此,如果您在项目根目录中有bootstrap-3.3.5-dist,并且您的索引是/html/index.html,那么在您的索引中,您必须有... href="../bootstrap-3.3.5-dist/..." ...
  • 对不起。我在从项目中提取问题时犯了这个错误。然而,链接应该是项目中的../../,但在问题中,你是对的,../
  • 我没有在你的结构中看到你的 glyphcon 字体文件夹,这正常吗?
  • 也许这就是你要找的。希望这会有所帮助。 :) 在这里查看接受的答案stackoverflow.com/questions/19608873/…

标签: html css twitter-bootstrap


【解决方案1】:

root path 是您网站的顶部路径。它没有父文件夹。你可以去//index.hmtl,但是,/../foo

document root 将网站的根路径映射到文件系统的目录。在您的文件系统上,文档根目录可能不是文件系统根目录,而是有一个父目录。

但是,就网站而言,根目录之上没有任何内容。因此,不在文档根目录下的目录完全超出了网站的范围。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多