view raw
KrBa KrBa - 6 months ago 68
CSS Question

Including css from other folder

I would like to know whether there's an easy common way to include a css file, which is in a folder, from a html/php file inside another folder?

The structure looks like this:


  • index.php

  • about


    • index.php


  • css


    • style.css




What I want is to know how to get the correct path to the style.css file inside the css folder from the index.php hidden in that about directory.

Answer

This is going in about/index.php?

<link rel="stylesheet" href="../css/style.css" />

.. basically says, "Go up one level from where this script is located."