css 文件未使用 xampp 加载到本地主机上

时间:2021-07-30 21:31:28

标签: html css xampp localhost

我正在尝试在本地主机上的 php 文件中包含 css 和 js 文件:

<link rel="stylesheet" href="http://localhost/neu/css/bootstrap.min.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="http://localhost/neu/css/jquery-ui.css" type="text/css" charset="utf-8" />
<script type="text/javascript" src="http://localhost/neu/scripts/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="http://localhost/neu/scripts/jquery-ui.js"></script>
<script type="text/javascript" src="http://localhost/neu/scripts/bootstrap.min.js"></script> 

我正在使用具有这种结构的 xampp:

css 文件:

enter image description here

php 文件:

enter image description here

在站点的源代码视图中,我可以单击 .css 和 .js 文件的链接,并显示正确的文件。

我也试过 href="neu/css/... 但同样的,.css 和 .js 没有加载到我的页面上。 还尝试从外部加载 .css(如 <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">)但相同。

那么 xampp 可能以某种方式阻止了链接?谢谢

编辑:

来自开发者工具的屏幕截图:

enter image description here

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:-1)

如果您的根文件夹是 neu,那么我认为没有必要在地址中添加 hat。尝试使用 ....href="css/... 此外,我有时在添加 css 时不会遇到样式变化,直到我清除缓存......我认为在你的情况下是地址,然后尝试清除缓存

相关问题