Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link stylesheet from a parent folder

Tags:

html

css

php

I have the following folder setup:

Main
    css
        stylesheet.css
    sub
        example
            index.php
    index.php

How do I link stylesheet.css for the index.php file in example?

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

This only works for index.php in the Main section.

like image 926
frosty Avatar asked Jul 04 '15 03:07

frosty


People also ask

How do you reference a parent folder?

In a DOS, Windows or Mac command line, two dots (..) refer to the preceding folder/directory level.

How do I link a stylesheet in the same folder in HTML?

The href attribute A common situation is that the CSS file and the HTML file are in the same folder. In such a case you can write href="style. css" . If the CSS file and the HTML file are in different folders, you need to write the correct path that needs to go from the HTML file to the CSS file.


1 Answers

You can go two directories back like this: ../../

../ is used to fill the relative path structure.

<link rel="stylesheet" type="text/css" href="../../css/stylesheet.css">
like image 147
m4n0 Avatar answered Oct 21 '22 02:10

m4n0