Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie with CSS (where is styles.css file)

Status
Not open for further replies.

zerod

Technical User
Feb 1, 2002
13
CA
I'm just getting into html programming and have a basic question about stylesheets. Many sites have the line:

<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;styles.css&quot;>

in the heading. Does this mean it's linking to a file called 'styles.css' that is stored on the server somewhere for that webpage? Or is it linking to someone elses server over the internet (i.e. is there just one file called styles.css that everyone is linking to)? Some clarification would be greatly appreciated.

zerod
 
The href=&quot;file.css&quot; part of the LINK tag is referring to a file on that person's/company's server. If you created your own style.css file and stored it in a directory called /stylesheets (on whatever server you're using), your href tag would look like this:

<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;stylesheets/styles.css&quot;>
<!-- Note that href is dependant on the file you're inserting the LINK tag into. So if your file is located in /root/somefolder/file.html, you'll need to backreference to the right directory: href=&quot;../../stylesheets/style.css&quot; -->

I would check this site for more help on CSS:
 
Thanks for the clarification.

zerod
 
PerlIsGood

So if your file is located in /root/somefolder/file.html, you'll need to backreference to the right directory: href=&quot;../../stylesheets/style.css&quot;

If any file is referenced from the root directory you should use a slash at the beginning of the URL.

The URL should look like this :

href=&quot;/stylesheets/style.css&quot;

Hope this helps Wullie

sales@freshlookdesign.co.uk

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top