Welcome Guest, Not a member yet? Register   Sign In
css are not loading
#11

(This post was last modified: 06-12-2018, 10:13 PM by Amonza. Edit Reason: further example )

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?
EG
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
Reply
#12

(This post was last modified: 06-13-2018, 03:34 AM by InsiteFX.)

That's because your paths are wrong.

CodeIgniter User's use a folder structure like this:

./application
./system
public or public_html
-- assets
---- css
---- fonts
---- img
---- images
---- js
index.php

Then you can access all your files like this:


Code:
<!-- 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 )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB