简体   繁体   English

当html文件位于文件夹中时,CSS无法在带有js的模板中工作

[英]CSS not working in a template with js while html file is in a folder

I am very new to using templates. 我是新手使用模板。 My CSS is not working if I put my html in another folder. 如果我把我的html放在另一个文件夹中,我的CSS无法正常工作。

I have realised the css was being applied through JavaScript which I am also new too. 我已经意识到css正在通过JavaScript应用,我也是新的。 I have guided the link for css/js the correct folders and files but it still wont work. 我已经指导css / js链接正确的文件夹和文件,但它仍然无法正常工作。

The relevant files are /Linear/index.html and /Linear/builds/index.html (where the error is) and the js and css folders 相关文件是/Linear/index.html/Linear/builds/index.html (错误在哪里)和js和css文件夹

https://www.dropbox.com/s/cmmdybvbhvff0w4/Linear.zip?dl=0 https://www.dropbox.com/s/cmmdybvbhvff0w4/Linear.zip?dl=0

Removing the noscript tag around the css link will solve this; 删除css链接周围的noscript标记将解决此问题;

So, instead of 所以,而不是

<noscript>
        <link rel="stylesheet" href="../css/skel-noscript.css" />
        <link rel="stylesheet" href="../css/style.css" />
        <link rel="stylesheet" href="../css/style-desktop.css" />
</noscript>

You have; 你有;

<link rel="stylesheet" href="../css/skel-noscript.css" />
<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/style-desktop.css" />

You can download the modified version here 您可以在此处下载修改后的版本

https://www.dropbox.com/s/lewnpt0iy980i53/Linear-Modified.zip?dl=0 https://www.dropbox.com/s/lewnpt0iy980i53/Linear-Modified.zip?dl=0

In your template used skel.js and the style base path defined into it. 在您的模板中使用了skel.js和定义在其中的样式基本路径。 So if you want your other html file that exist in other child folder work well, you must change the skel.js file. 因此,如果您希望其他子文件夹中存在的其他html文件运行良好,则必须更改skel.js文件。

Also in your index.html file used "noscript" tags. 另外在index.html文件中使用了“noscript”标签。 Its mean is if your browser dose not support JavaScript then load the css file, So if you remove this tags it works well like file that exist in root Folder. 它的意思是如果你的浏览器不支持JavaScript然后加载css文件,那么如果删除这个标签它就像root文件夹中存在的文件一样。

    <script type="text/javascript" src="../js/skel.min.js"></script>
    <script type="text/javascript" src="../js/skel-panels.min.js"></script>
    <script type="text/javascript" src="../js/init.js"></script>

    <link rel="stylesheet" href="../css/skel-noscript.css" />
    <link rel="stylesheet" href="../css/style.css" />
    <link rel="stylesheet" href="../css/style-desktop.css" />

</head>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM