将 .css 链接到另一个文件夹 [英] Link a .css on another folder

查看:27
本文介绍了将 .css 链接到另一个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些关于如何链接事物的问题.

I have some questions about how to link things.

想象一下,我有一个文件夹网站",用于存储我的网站文件,还有另一个文件夹,其中包含字体,并且字体文件夹为每种字体提供了更多文件夹.我的 html 和 css 文件直接位于网站文件夹中.我的 font-face-css 文件位于/font 文件夹中.

Imagine that I have a folder "Website" where my files for that website are stored, and another folder with fonts, and that the font folder has more folders for each font. My html and css file is directly on the website folder. My font-face-css file is on the /font folder.

我想将我的 css 文件链接到我的 html 文件,所以我这样做:href="stylesheet.css"

I want to link my css file to my html file, so I do this: href="stylesheet.css"

我也想将我的 font-face-css 文件链接到我的 html 文件,那么我应该在 href="" 里面放什么?

I also want to link my font-face-css file to my html file, so what should I put inside href=""?

而且我还想将我的字体链接到我的 font-face-css 文件中,它们在它们自己的文件夹中,该文件夹也在 font 文件夹中,这是 css 文件所在的位置,我应该在 src 中放什么:?

And I also want to link my fonts, which are in their own folder, which is also inside the font folder which is where the css file is to my font-face-css file, what should I put inside the src:?

 1 Website folder
    1.1 Fonts folder (/fonts)
       1.1.1 Font1 folder (/fonts/font1)
             1.1.1.1 ttf file (/font/font1/font1.ttf)
             1.1.1.2 svg file (/font/font1/font1.svg)
       1.1.2 Font2 folder (/fonts/font2)
             1.1.2.1 ttf file (/font/font1/font2.ttf)
             1.1.2.2 svg file (/font/font1/font2.svg)
    1.2 html file (file.html)
    1.3 css file  (file.css)

谢谢

推荐答案

我没看明白,你想链接一个外部 css 作为你上面定义的文件结构吗?如果是,那么只需使用链接标签:

I dont get it clearly, do you want to link an external css as the structure of files you defined above? If yes then just use the link tag :

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

所以基本上对于您网站文件夹(包含索引的文件夹)下的文件,您可以直接调用它.对于每个连续的文件夹,例如在您的情况下使用/":

so basically for files that are under your website folder (folder containing your index) you directly call it. For each successive folder use the "/" for example in your case :

    <link rel="stylesheet" type="text/css" href="Fonts/Font1/file name">
    <link rel="stylesheet" type="text/css" href="Fonts/Font2/file name">

这篇关于将 .css 链接到另一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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