如何从不同分支的文件夹连接文件?

问题描述 投票:0回答:1

所以我尝试将 css 从我的主文件夹和我的图标链接到不同分支/文件夹中的页面之一,但它不起作用。

我的代码

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TheAlphaLeopard</title>
    <link rel="shortcut icon" type="image/x-icon" href="../home/imgs/favicon.ico"/>
    <link rel="stylesheet" type="text/css" href="../home/styles.css" />
</head>

My Repo

我尝试在代码之前使用 ../,但它没有正确链接文件。

html
1个回答
0
投票

您需要上移两级,因为您的 html 文件路径是

THEALPHA.../app/chess/index.html
并且您的 css 文件位于 文件夹

THEAPHA.../home/styles.css

<link rel="stylehseet" type="text/css" href="../../home/styles.css">

专业提示:不要混淆 IT 中的分支和文件夹。

© www.soinside.com 2019 - 2024. All rights reserved.