Welcome to WebmasterWorld Guest from 126.96.36.199
Forum Moderators: not2easy
I am new to CSS and HTML, so this might be a very trivial question. I have a directory named "htdocs/css", where I store all of .css files. Then I have various webpages "htdocs/dir-1/.../dir-n/index.html" spread all around in htdocs directory for different parts of the site. I want to link the each index file with respective .css file using an absolute path like
<LINK ....... href="$somevariable/css/example.css >
and not a relative path like
<LINK ....... href="../../css/example.css >
is there a way I can do it? Please let me know
<link rel="stylesheet" type="text/css" href="/css/example.css">
<link rel="stylesheet" type="text/css" href="/css/example.css" />
Put that in your head section.
I have a file head.php which contains all the links to css files and script files (basically everything that goes in the <head> tag).
If I include that file in two pages, one in the root folder and one in a subfolder, the one in the subfolder will not be referenced properly since the link to the css file is relative to the root folder:
<link type="text/css" src="css/style.css" />
Adding the '/' to the front of the filepath does not resolve the issue in this case.