Welcome Guest, Not a member yet? Register   Sign In
linking images from css
#1

[eluser]Unknown[/eluser]
hi,

my css files are stored in /css/960/example.css and how do i link images from css so they can be found each time? for example for background-image:url(images/image.gif)

the problem is if i have some deep page like http://domain.com/news/article/123/full-view the the image is not properly linked because the path is wrong...

remember that i don't want to use absolute paths only relative ones..
#2

[eluser]Tripic[/eluser]
have you tryed link tag in html helper?
http://ellislab.com/codeigniter/user-gui...l#link_tag
#3

[eluser]Unknown[/eluser]
[quote author="Tripic" date="1278974827"]have you tryed link tag in html helper?
http://ellislab.com/codeigniter/user-gui...l#link_tag[/quote]

i know how to load the css but how do i get proper image url's from INSIDE the CSS?
#4

[eluser]Brandon Beasley[/eluser]
Is this what you are asking?

Code:
<img src="&lt;?=base_url() ?&gt;images/test.png" alt="test PNG" />

base_url() will be pulled from settings in config.php
#5

[eluser]danmontgomery[/eluser]
In a .css paths are always relative to the css file.

in /css/960/example.css,

Code:
background-image: url('images/image.jpg');

Would be looking for /css/960/images/image.jpg
#6

[eluser]InsiteFX[/eluser]
Code:
css
images

background-image: url('../images/image.jpg');

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB