Hi,

Come to think of it this is probably not the right forum for this question but hopfully someone will have the answer.
I am new to php, mysql and html and am trying to learn it. I got a website developed for me but had taken ownership of the code and am trying to redevelop the site.
I installed wampsever on my PC and am trying to run the site from localhost.
I am having a problem with css files called from a html file which are not working.
This is the code

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title><?=$title?></title>
<meta name="keywords" content="<?=$keywords?>" />
<meta name="description" content="<?=$description?>" />
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<link rel="stylesheet" type="text/css" href="/styles/default.css" />
<link rel="stylesheet" type="text/css" href="/styles/topnavlist.css" />
<link rel="stylesheet" type="text/css" href="/styles/menu.css" />
<script type="text/javascript" src="/js/jslib.js"></script>
<script type="text/javascript" src="/js/ftb.js"></script>
</head>
<body >
<div id="outer">
<center>

to get around the problem i removed the path names from the href entry and just left the file name and moved all the css files to my root directory from the styles directory which seemed to work.

This is not the correct solution though as I need to keep the paths in place as they are on my live site..

Is there some root directory setting in php/wampserve/html I need to set so the css files are picked up from the styles directory.

Thanks in advance for your help.

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

    Lose the slashes before styles/thisfile.css

      Thanks but I need to keep the code the same as live.
      There must something I haev to set in order to resolve this problem.
      i do not want to start changing the code.

        /styles/default.css

        is relative to the web root so no matter where it's hosted if the styles dir is one directory down from the web root it will work.

          Write a Reply...