Reputation: 13
I have two html files using one css file. The one is working the other is not. In the first 'working' case, the html syntax is (css file is in the same directory):
<!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" dir="ltr" lang="en-US">
<head>
<title>Our first page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="ourstyle.css"></head>
In the second 'not working' case, the html syntax is (css file is in one folder up):
<!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" dir="ltr" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Our second page</title>
<link rel="stylesheet" type="text/css" href="../ourstyle.css"></head>
When running both files locally, the css file works, but on a server it does not. I am using javascript and jquery in the second html file. I did what they suggested in the question on Two Linked CSS Files Not working but still did not work. Please help.
PS This is my first question I am asking, so please let me know if I was not specific or clear enough. Thank you.
To clarify: I don't have ourstyle.css in two separate directories in my local environment nor on a server. I have it only in the parent directory. So practically, I have the parent folder WWW, in which I have the 3 things: 1. the 'working' html script (with syntax 'href="ourstyle.css"') 2. the file ourstyle.css 3. the folder called cgi-bin, in which I have the 'not working' html script (with syntax 'href="../ourstyle.css"') The same folder structure I have locally and it is running. On server it does not.
Thank you for your help.
Upvotes: 1
Views: 709
Reputation: 2522
Rather put ourstyles.css into a folder (like CSS) and then refer to them the same, i.e. /CSS/ourstyle.css (and not ../ourstyle and outstyle). Putting your scripts in js folders and styles in css folders is good practice. You will thank yourself later when you are working with lots of files.
Upvotes: 1