Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
html基标记无法正常工作_Html_Base Path - Fatal编程技术网

html基标记无法正常工作

html基标记无法正常工作,html,base-path,Html,Base Path,我在head中使用了html基标记,但效果不是很好 这是我的文件夹结构 - BaseWebsite (Folder) - - Root (Folder) - - default.html - - css (Folder) - - js (Folder) - - image (Folder) 在IIS中,我创建了一个指向BaseWebsite的新网站,并使Root成为一个应用程序 这是我在default.html中的代码 现在,js和image都显示了,但是当href变成href=/Root/R

我在head中使用了html基标记,但效果不是很好

这是我的文件夹结构

- BaseWebsite (Folder)
- - Root (Folder)
- - default.html
- - css (Folder)
- - js (Folder)
- - image (Folder)
在IIS中,我创建了一个指向BaseWebsite的新网站,并使Root成为一个应用程序

这是我在default.html中的代码

现在,js和image都显示了,但是当href变成href=/Root/Root/css/site.css时,css没有显示


这是正常的还是我该如何解决?我可以通过将css的href更改为/Root/css/site.css来解决这个问题,但是有很多地方需要更改。

我不知道ISS的行为如何,但请尝试使用点:

<link rel="stylesheet" type="text/css" href="./css/site.css" />
我希望有帮助

简要说明: /从default.html所在的位置开始

龙在这里解释道:

在a中,href属性必须是绝对URL,例如http://www.example.com/foo/bar/. 以/或开头的URL。是相对的


您需要修复绝对URL或使用其他一些技术,例如服务器端编程工具或预处理器。

HTMLTanks中的End标记指出这一点:如果您使用的是as base,那么您是否应该执行../css/以获取css文件夹的相对路径?我的问题是,如果js和image正常工作,为什么css不正常?是的。我知道这可能有用。但是我的问题是我无法更新所有的css链接,因为它们正在到处传播。我认为这是错误的。基本URL可以是相对的。见和。
<base href="/Root/" />
<link rel="stylesheet" type="text/css" href="./css/site.css" />