How do I link external style sheet to multiple pages and folders?

后端 未结 2 2017
悲哀的现实
悲哀的现实 2021-01-06 18:01

im building a pretty large website that will have many pages and folders. I have 1 stylesheet.

How do I add the style sheet to \"ALL\" of these folders? I didnt have

2条回答
  •  囚心锁ツ
    2021-01-06 18:29

    If a file is linked above the current directory (meaning the file you want to link is outside of the folder where the linked document is stored) you have to write it like this:

    ../file.html

    If it is above the current directory and inside a different folder, you link like this:

    ../diffFolder/file.html

    If it is deeper in the current directory (meaning it is within a folder of the current directory) do it like this:

    deeperFolder/file.html

    The other option of course would be to create a php header document and require/include it in your other pages. It really is the way to go with big sites that reuse content. I am working on a smallish website right now, but every part that is reused is it's own individual document that is required server side whenever the link is called. So if I make a change to the header, it affects every page. Same with footer, sidebar, etc.

    This website actually explains dynamic inclusion on a pretty basic level quite well: http://inobscuro.com/tutorials/php-dynamic-includes-16/#

提交回复
热议问题