CSS - Image Links Problem - 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: CSS - Image Links Problem (/showthread.php?tid=13992) |
CSS - Image Links Problem - El Forum - 12-14-2008 [eluser]jaswinder_rana[/eluser] I have structure like this system public_html -public/images -public/css So, my system is below my index.php. My actual files, on my local server, are http://localhost/my/mypage/index.php So, system is at http://localhost/my/system (was testing how will it work if I put it before public_html; so here mypage is ACTING like public_html). Anyways. I am including my CSS like echo link_tag('/public/css/admincp.css'); In my CSS, I have a background image like background:#fff url(/public/images/footer_bg.gif) top left repeat-x; Now, my CSS link works but image doesn't. I understand that link_tag() function appends base_url in front of the CSS link. Is there a way that I can do the same for my background images? I don't want to have to change path if I change a directory. What if I rename my public_html (in this case mypage) directory? So, in short, mypage is ACTING like public_html but is NOT public_html, /public/images/... links won't work because mypage is at http://localhost/my/mypage (it's /my/mypage/public/image/...) Not sure if I explained it properly. Thanks CSS - Image Links Problem - El Forum - 12-15-2008 [eluser]Kotzilla[/eluser] try this background:#fff url('../images/footer_bg.gif') top left repeat-x; its refer on CSS file location. then you have to locate image by css file location is ../images/ =) CSS - Image Links Problem - El Forum - 12-15-2008 [eluser]jaswinder_rana[/eluser] [quote author="Kotzilla" date="1229343582"]try this background:#fff url('../images/footer_bg.gif') top left repeat-x; its refer on CSS file location. then you have to locate image by css file location is ../images/ =)[/quote] Thanks. I was hoping that there's a way to pass base URL to css file (if I rename it to .php and use header to change Content Type). Oh well. Thanks |