Welcome Guest, Not a member yet? Register   Sign In
full path in css folder
#1

[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?
#2

[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.
#3

[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




Theme © iAndrew 2016 - Forum software by © MyBB