【问题标题】:Stylesheet, Image not loading while it was linked to the index.php file from the header样式表,图像从标题链接到 index.php 文件时未加载
【发布时间】:2019-03-11 08:52:15
【问题描述】:

由于某种原因,我无法将我的文件和外部样式表、外部 JS 文件链接到我的 index.php 文件。

我已将目录 akobuy > styles 文件夹中的 index.php 链接到 style.css:

我尝试了几个选项,但似乎没有加载样式表:

 1. <link rel="stylesheet" type="text/css" href="styles/style.css">
 2. <link rel="stylesheet" type="text/css" href="/styles/style.css">
 3. <link rel="stylesheet" type="text/css" href="./styles/style.css">
 4. <link rel="stylesheet" type="text/css" href="../Akobuy/styles/style.css">

JS 和图片也是如此:

我尝试了其他几个编辑器同样的问题。

【问题讨论】:

  • 能不能也显示结果
  • 尝试使用 ctrl+f5 刷新页面
  • 就像@ZeeshanAhmadKhalil 说的那样,尝试使用 ctrl + f5 刷新并打开inspect element 并检查network 选项卡,你看到你的cssjs 在那里吗?
  • 权限?这些文件可读吗?
  • 你可以阅读/打开http://whateveryourdomain.is/styles/style.css吗?

标签: javascript php html css stylesheet


【解决方案1】:

试试这个:

<link rel="stylesheet" type="text/css" href="../styles/style.css">

与您的图片相关。 ../ 表示返回父级。

【讨论】:

猜你喜欢
  • 2015-01-05
  • 1970-01-01
  • 2015-06-17
  • 2021-12-27
  • 2014-06-22
  • 1970-01-01
  • 2015-08-19
  • 2016-10-24
  • 1970-01-01
相关资源
最近更新 更多