CSS file pathing problem

Posted by Alan Harris-Reid on Stack Overflow See other posts from Stack Overflow or by Alan Harris-Reid
Published on 2010-05-31T23:13:30Z Indexed on 2010/05/31 23:33 UTC
Read the original article Hit count: 398

Filed under:
|
|
|
|

Hi there,

When designing a HTML template in my favorite editor (TextPad at the moment) I can view my code in a browser by pressing F11 or the appropriate toolbar button. I have my common css rules in a separate file so my HTML contains the code:

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

This works when the .css file is in the same folder as the .html file, or if I fully path the .css file in the href property, eg. ///c:/mycssfolder/commoncss.css

However, in a 'live' situation I want the .css file to reside in a common folder which is accessible from a number of .html files (eg. href='css/commoncss.css', where the css folder is configured at web-server level).

How can I achieve this design vs. live dilemma without copying css file to all .html folders (and all the maintenance headaches that comes with it)?

I am using Python 3.1 with Jinja2, but I guess this problem is applicable across any language and template-engine.

Any help would be appreciated.

Alan

© Stack Overflow or respective owner

Related posts about python

Related posts about css