Codeigniter + CSS not working well, possible baseurl - 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: Codeigniter + CSS not working well, possible baseurl (/showthread.php?tid=56303) |
Codeigniter + CSS not working well, possible baseurl - El Forum - 12-09-2012 [eluser]Unknown[/eluser] This question has been asked several times, but I researched and still can't solve it. In one of my view file, I have (referencing to my css): link rel="stylesheet" type="text/css" href="/application/views/screen.css" The css file is in: - www - application - view - css - screen.css - system I also tried to setup the css in the same folder under -www and use it directly by - www - application - view - css - screen.css - system link rel="stylesheet" type="text/css" href="css/screen.css" or link rel="stylesheet" type="text/css" href="/css/screen.css" both doesn't work My base url is set to "" because I develop locally. Is this the issue? I'm Using wamp server. Codeigniter + CSS not working well, possible baseurl - El Forum - 12-09-2012 [eluser]apodner[/eluser] Typically, I create an "assets" directory for files that need to be accessed. -application -system -assets --images --scripts --styles the rule of thumb is usually that all file references are based upon the index.php file. In theory, this means you would access an image via "assets/images/imageName.jpg" When I am building stylesheet and javascript links, I usually do the following: <link rel="stylesheet" type="text/css" href="<?=base_url()?>assets/styles/style.css" /> Never had any problems with it when I do it this way. You might also consider setting up for multiple environments. Have your base url set one way for development and another for production. http://ellislab.com/codeigniter/user-guide/general/environments.html Codeigniter + CSS not working well, possible baseurl - El Forum - 12-09-2012 [eluser]Aken[/eluser] The application folder has an .htaccess in it that denies any HTTP requests to that folder. As apodner recommended, your static assets work better in their own directory. Codeigniter + CSS not working well, possible baseurl - El Forum - 12-11-2012 [eluser]ramirors[/eluser] Are you using .htaccess (to remove index.php) on your webroot? Codeigniter + CSS not working well, possible baseurl - El Forum - 12-12-2012 [eluser]nishant1234[/eluser] go to the site www.w3schools.com its really helpful |