• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
css are not loading

Well I got this working, so going to leave this here in case it helps any one else or for further comment.
I moved my css files into a folder at the same level of the application folder (i.e as a sibling).
With the css files in the root of this folder the css would load correctly, placing them in a another folder level beneath this and they would not load.
So I moved the css into a folder under the application folder called assets and placed my css in a folder in this folder and all works.
So I got my templates working but why would CI not load the css in my first attempts?
localhost/codeigniter/bootstrap/css/bootstrap.min.css -- DOESNT WORK

localhost/codeigniter/bootstrap/css/files/bootstrap.min.css -- DOESNT WORK

localhost/codeigniter/css/bootstrap.min.css -- WORKS

localhost/codeigniter/application/assets/css/bootstrap.min.css -- WORKS

That's because your paths are wrong.

CodeIgniter User's use a folder structure like this:

public or public_html
-- assets
---- css
---- fonts
---- img
---- images
---- js

Then you can access all your files like this:

<!-- Bootstrap CSS file -->
    <link href="<?php echo base_url('assets/css/bootstrap.min.css'); ?>" rel="stylesheet">

Hope that helps.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.