文件夹以外的文件夹路径 [英] Path to folder outside of folder

查看:133
本文介绍了文件夹以外的文件夹路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的主文件夹中有一个用于所有CSS的文件夹,称为"main".在主"中,我还有另一个名为数学"的文件夹.我想在数学"文件夹中使用CSS,但是当我键入以下内容时:

I have a folder for all my css in my main folder called "main." In "main" I have another folder called "math." I would like to use my css in the "math" folder, but when I type:

      <link rel="stylesheet" href="css/basic.css" type="text/css" media="screen" />

在"math"文件夹的index.html上,它可以正常工作.我认为这是因为它正在寻找math文件夹内的css文件夹.如何链接到不在math文件夹中的css文件夹?

on the index.html of the "math" folder it doenst work. I think it's because it's looking for the css folder inside of the math folder. How can i link to the css folder, which is not in the math folder?

推荐答案

据我了解,您的目录结构如下:

If I am understanding, your directory structure is as follows:

siteroot
    main
       math
       css

您希望从/main/math/index.html链接到/main/css中的样式表.

You are looking to link to a style sheet in /main/css from /main/math/index.html.

有两种解决方案,最简单的方法是使用绝对路径:

There are two solutions, the easiest is to use an absolute path:

  <link rel="stylesheet" href="/main/css/basic.css" type="text/css" media="screen" />

绝对路径是更好的解决方案,并且可以减少以后的头痛.我也不知道有什么缺点.

Absolute paths are a better solution and will cause less headache down the road. I do not know of any drawbacks, either.

或者,您可以使用'..'遍历目录

Alternatively, you could use '..' to traverse up a directory

 <link rel="stylesheet" href="../css/basic.css" type="text/css" media="screen" />

这篇关于文件夹以外的文件夹路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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