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

  • 5 years ago
Drew McLellan

Drew McLellan 2638 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">