CodeIgniter Forums
full path in css folder - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: full path in css folder (/showthread.php?tid=13204)



full path in css folder - El Forum - 11-14-2008

[eluser]belbek[/eluser]
I have CSS file in css folder where I have for example this:

body {
background: #F5F5F5 url(images/img01.gif) repeat-x;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
color: #474848;
}

As I know I can't use base_url(); in css folder,
should I write full path everywhere in a such rules?


full path in css folder - El Forum - 11-14-2008

[eluser]Pascal Kriete[/eluser]
Urls in css files are always relative to the location of the css file, not the current url. So you shouldn't have any problems using relative paths.


full path in css folder - El Forum - 11-14-2008

[eluser]thinkigniter[/eluser]
Here is a tip that saved me a lot of pain.

Change the location of your css, images etc. to a folder under the root directory eg. /assets the store your ofther folders under that eg. /assets/css, /assets/images etc. etc.

Then make reference to them in your html like...

body {
background: #F5F5F5 url(/assest/images/img01.gif) repeat-x;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
color: #474848;
}

The "/" at the beginning says "start at the root of my sites folder" in this way it will not matter where your html/php file is located it will always go back to your root folder.

I hope this makes sense?

Cheers