0

HTML file path

Here's a situation I have a HTML file with name : template.html in folder named : html. I want to link a external css file named style.css which is located in folder named css to template.html . I want to do it using reative paths ( for now I strictly don't want to use absolute paths ) PS : Folder named css and html are inside same folder . Thanks in advance

10th Apr 2020, 4:18 PM
Naveen K R
6 Respuestas
+ 2
If I understood your explanation correctly, then perhaps you can try this; <link rel="stylesheet" href="../css/style.css">
10th Apr 2020, 4:50 PM
Ipang
+ 1
Ipang I tried that path and it didn't worked
10th Apr 2020, 4:57 PM
Naveen K R
+ 1
Is your folder structure as follows? . (base folder) ./css/ style.css ./html/ template.html Maybe I didn't get the layout correctly ... (Edited)
10th Apr 2020, 5:02 PM
Ipang
+ 1
Naveen K R I understand the same as Ipang and its code should works as is... Are you sure that's the css file wich isn't correctly linked? Maybe you've some relative urls in your css code and you don't correctly link these ressources (they should be relative to the css file location, not the html file location)?
10th Apr 2020, 5:15 PM
visph
visph - avatar
+ 1
Ipang yes
10th Apr 2020, 5:31 PM
Naveen K R
+ 1
Naveen K R Create a new web code in SoloLearn. Put content of template.html file in HTML tab and put content of style.css file in CSS tab of the new code. Then share the link here.. Maybe that way things can become clearer.
10th Apr 2020, 6:08 PM
Ipang