Welcome Guest, Not a member yet? Register   Sign In
CSS & CI quick help
#1

[eluser]boony[/eluser]
Hi Folks,

Been away awhile researching CMS systems and tend to hate them all ;-)

Anyway, a quick question. I need to set the background image using CSS but can't recall how to get CSS to point to the right folder.

ie what I need is..
Code:
.container {background: url(/image/bgimage.gif;}

I tried the
Code:
<?=base_url();?>
but of course that doesn't work. Any help greatly appreciated. :lol:

Regards
#2

[eluser]John_Betong[/eluser]
 
This is a very old chestnut and different people have different ideas as to where to have the CSS file saved.

I prefer it to be along with my view files and you can see the line I use in my header here along with the CSS file background image instruction:
Code:
// from my views header file:
<link type='text/css' href='/justjokes/views/style_001.css.php' rel='stylesheet' media='all' />

// from my CSS file in the views directory
body{background:#fff url(grad_green.jpg) 0 0 repeat-x;color:#0fc;margin:0 auto}

// the background image file is also saved in the views folder
grad_green.jpg
 
 
 
#3

[eluser]sudesh[/eluser]
you should use relative path from your css file to your image folder in css

example below is your folder structure

CI/
--CSS/
--Somefolder/
----Image/

now to access image from above image folder u should use below way

Code:
.container {background: url(../Somefolder/image/bgimage.gif;}

i hope this would help u
#4

[eluser]boony[/eluser]
[quote author="sudesh" date="1249736533"]
Code:
.container {background: url(../Somefolder/image/bgimage.gif;}

[/quote]

Ahh, silly silly me...
I had this
Code:
.container {background: url(../images/bgimage.gif);
But it should be this
Code:
.container {background: url(../../images/bgimage.gif);

Must remember that we can go deep in the directory structure with CI

All is now good :cheese:




Theme © iAndrew 2016 - Forum software by © MyBB