www.webdeveloper.com
Results 1 to 2 of 2

Thread: css files not displaying in apache2 server

  1. #1
    Join Date
    Dec 2013
    Posts
    57

    css files not displaying in apache2 server

    I have added a css stylesheet into an html page(.php extension though) but the css isnt being loaded onto the page.
    I am using ubuntu 12.04 desktop with apache2

    the css file is located inside of my var/www folder and here is the line of code linking to the stylesheet.

    HTML Code:
     <link rel="stylesheet" type="text/css" href="./styles-blue2.css" >
    I've tried many different combinations such as var/www/styles-blue2.css , ../var/www/styles-blue2.css

  2. #2
    Join Date
    Mar 2012
    Posts
    1,269
    1. If the CSS file in the same directory as the PHP file no path is needed.
    E.g. href="styles-blue2.css"

    2. If the CSS file in the root directory of the site, prefix the file name with "/",
    E.g. href="/styles-blue2.css"

    3. If the CSS file is in a child directory of the PHP file, prefix the file name with "<child>/". E.g. href="css/styles-blue2.css"

    4. If none of the above, give the path from the root.
    E.g. href="/css/styles-blue2.css"

    I think 2 is what you need, but that depends on whether "www" is the root directory (it usually is).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles