Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Subdirectory problem with css

    I'm sure this is very easy to solve for you guys, but for me I have no idea. Please help.

    I have recently made the move to learning div and css, and I'm a little stuck with my stylesheet. I want to use it across my whole website, but I have many subdirectories each with their own index files (in php). When I try and include the stylesheet with one of these index files, it assumes it is in the subdirectory, which of course it isn't. I don't want to make a stylesheet for each directory, as it kinda defeats the purpose. So I want to know how to link to a directory outside and possibly above the subdirectory I am working on.

    I have this problem twice because I am also trying to include a header and footer file, with the same problem. I already tried the full localhost address, but that didn't help.

    Thanks for your help, anyone who can.

  • #2
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,338
    Thanks
    29
    Thanked 282 Times in 276 Posts
    You can reference the root directly with / and the parent directory with ../. Below are examples.

    Code:
    @import "/root.css";
    @import "../parent.css";
    @import "../../grandparent.css";
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #3
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Great, I'll give it a try... thanks for the swift reply too, perfecto!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •