html< base>标记引用本地文件夹 [英] html <base> tag referring to local folder

查看:82
本文介绍了html< base>标记引用本地文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用基本标记设置本地站点根。以下代码不起作用。难道我做错了什么?如何将 mysite 文件夹设置为基础?

 < ;! DOCTYPE html PUBLIC -  // W3C // DTD XHTML 1.0 Frameset // ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\"> 
< html xmlns =http://www.w3.org/1999/xhtml>
< head>
< base href =file:/// home / me / mysite>< / base>
< title>资产承担流程< / title>
< meta http-equiv =content-typecontent =text / html; charset = UTF-8/>
< link rel =stylesheettype =text / csshref =/ css / main.css/>
< / head>
< body>
某些东西
< / body>
< / html>

网站的文件夹结构是

  mysite 
| ___ css
| ___ img
| ___ js

等等。



当我加载网页时,它看不到 main.css code>在 css 文件夹中。

解决方案

如果你删除了/,它应该使它与当前路径相对,当存在基本标记时,它将是

  HTTP://本地主机/网站/。 

您还需要在href的末尾添加尾部/以指示它是一个

完整示例:

 <!doctype html> ; 
< html>
< head>
< base href =/ test //>
< script src =assets / test.js>< / script>
< body>
hi
< / body>
< / html>




  • 实际上取决于你问的对象,因为它是相对的关闭当前的域名。但我更愿意称之为绝对的,因为它表示路径来自根目录,基于当前域。虽然,我想在技术上,这使得它在事物的宏伟计划中是相对的,绝对只是在当前领域方面。无论如何。


请参阅此链接

http://social.msdn .microsoft.com /论坛/ ie / en-US / c51bb8b9-40ab-437b-a125-88b660f3e1ca / ie8-base-tag-issues


I'm trying to set a local site-root using the base tag. The following code isn't working. Am I doing something wrong? How do I set the mysite folder as base?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <base href="file:///home/me/mysite"></base>
      <title> Asset Take On Process </title>
      <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 
      <link rel="stylesheet" type="text/css" href="/css/main.css" />
    </head>
    <body>
      some stuff
    </body>
  </html>

The site folder structure is

mysite
   |___css
   |___img
   |___js

and so on..

When I load the web-page it doesn't see the main.css in the css folder at all.

解决方案

If you remove that /, it should make it relative off the current path, which, when a base tag is present would be

http://localhost/website/.

You will also need to add a trailing / to the end of the href, to indicate that it's a folder.

Full working example:

<!doctype html>
<html>
<head>
<base href="/test/" />
<script src="assets/test.js"></script>
<body>
hi
</body>
</html>

  • Actually depending on who you ask, it's still relative since it is relative off the current domain. But I prefer to call this absolute since it's signifying the path is from the root, based on the current domain. Although, I guess technically that makes it relative in the grand scheme of things, and absolute only in terms of the current domain. Whatever.

kindly refer this link

http://social.msdn.microsoft.com/Forums/ie/en-US/c51bb8b9-40ab-437b-a125-88b660f3e1ca/ie8-base-tag-issues

这篇关于html&lt; base&gt;标记引用本地文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆