We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question

Use "Document Root" on a css link

Hi,

I am using a single css file to style my website using an include to get head.php

<?php include('include/head.php'); ?>

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

My problem comes when I create a separate folder with other files. Now css link path should be ../css/style.css

Is there any way to use some DOCUMENT_ROOT/css/style.css ?

Thanks!

Raul Serrano

Raul Serrano 0 points

  • 2 years ago
Drew McLellan

Drew McLellan 2637 points
Perch Support

You can make your links relative to the root of the site by starting them with a /

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