• 0

CSS file not being read


Question

I included the css file in my html template but its not being read. Also remember that the file is in /pages so thats why I put /public_html/style.css. Here is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="/public_html/style.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" type="image/x-icon" href="/public_html/favicon.ico">
</head>

The code is just for the head and thats it although there is still more.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

You don't include public_html/. This is actually more of a server-side directory to let you know where you put your files so that you can read it on the web.

You do not include this directory in any of your code unless you need an absolute path for a script or something. :)

So all of your content is under /pages/ and style.css is in the directory before /pages/? If so then you would do the following:

<link href="../style.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">

The ../ tells the server to go back a directory from /pages/.

Link to comment
Share on other sites

  • 0

You don't include public_html/. This is actually more of a server-side directory to let you know where you put your files so that you can read it on the web.

You do not include this directory in any of your code unless you need an absolute path for a script or something. :)

So all of your content is under /pages/ and style.css is in the directory before /pages/? If so then you would do the following:

<link href="../style.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">

The ../ tells the server to go back a directory from /pages/.

I nom nom nom on cupcakes. Thank you. +1 rep for you too!

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.