Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Designate the stylesheet path
Old 04-19-2006, 04:57 PM Designate the stylesheet path
Thort's Avatar
Average Talker

Latest Blog Post:
Popular Foxglove
Posts: 19
Location: Sweden
Trades: 0
Hi !

I want to use one external stylesheet file to control all my documents. Now I want to call upon this stylesheet from all my documents residing in different directories.

If the stylesheet is located in a directory lower than the document the code will be like this:

<link rel=stylesheet href="directoryname/stylesheet.css" type="text/css">

That's handy.

But, my question is: If the stylesheet is located one step higher in the directory-hierarchy
, is there a simple way to point to the stylesheet in the document?

Or, do I have to write the whole long path from C:/ an so on?


__________________
Thor


Please login or register to view this content. Registration is FREE
Thort is offline
Reply With Quote
View Public Profile Visit Thort's homepage!
 
 
Register now for full access!
Old 04-19-2006, 05:12 PM Re: Designate the stylesheet path
Cypher_489's Avatar
Skilled Talker

Posts: 81
Name: Callum
Location: England
Trades: 0
nope, just use ../

e.g.

root/about_us/about.htm - HTML file

root/style.css - CSS file

The HTML would be <link rel=stylesheet href="../style.css" type="text/css">

Hope this helps
__________________
Cypher_489


Please login or register to view this content. Registration is FREE
- Collection of tech tips, scripts and guides.
Please login or register to view this content. Registration is FREE
Cypher_489 is offline
Reply With Quote
View Public Profile Visit Cypher_489's homepage!
 
Old 04-19-2006, 05:18 PM Re: Designate the stylesheet path
Thort's Avatar
Average Talker

Latest Blog Post:
Popular Foxglove
Posts: 19
Location: Sweden
Trades: 0
Thanks Cypher_489 !

It works!

__________________
Thor


Please login or register to view this content. Registration is FREE
Thort is offline
Reply With Quote
View Public Profile Visit Thort's homepage!
 
Old 04-19-2006, 05:29 PM Re: Designate the stylesheet path
Cypher_489's Avatar
Skilled Talker

Posts: 81
Name: Callum
Location: England
Trades: 0
No problem! For future reference, if its two levels higher then it would be ../../style.css (Same pattern for 3, 4 levels etc...)
__________________
Cypher_489


Please login or register to view this content. Registration is FREE
- Collection of tech tips, scripts and guides.
Please login or register to view this content. Registration is FREE
Cypher_489 is offline
Reply With Quote
View Public Profile Visit Cypher_489's homepage!
 
Old 04-19-2006, 06:11 PM Re: Designate the stylesheet path
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
You might also be able to just use /style.css depending on where the stylesheet is located. Starting with the / is the same as saying root so you don't always need to use the ../ to back up a directory.

For example if your stylesheet is located in root/css/style.css then a path of /css/style.css should work from any of your pages.

Using the ../ works fine, but I know it's sometimes easy to make a mistake with it. It is for me anyway.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 04-19-2006, 06:13 PM Re: Designate the stylesheet path
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
or forget about the ../ notation totally and simply reference everything from the root folder

href="/directoryname/stylesheet.css"

that way it will be correct from any folder in the site without having to be concerned whether it is one above or two above.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-20-2006, 04:46 AM Re: Designate the stylesheet path
Thort's Avatar
Average Talker

Latest Blog Post:
Popular Foxglove
Posts: 19
Location: Sweden
Trades: 0
Thanks vangogh and chrishirst for the additional information!
__________________
Thor


Please login or register to view this content. Registration is FREE
Thort is offline
Reply With Quote
View Public Profile Visit Thort's homepage!
 
Old 04-26-2006, 02:41 PM Re: Designate the stylesheet path
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Just to make life more confusing...

What I find works the best is to put the absolute path to the CSS file in the href property. e.g. http://www.domain.com/CSS/mycss.css . That way, no matter where you put a file that accesses it, the file going to access it from the same place.

I haven't tried this with any localhost-type stuff, since the machine that's going to be my production server won't be ready for 2-3 weeks (money and all that). But it does work the way I just explained it.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Reply     « Reply to Designate the stylesheet path
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27367 seconds with 12 queries