Codeigniter: how to access css files from different views?

Tags: javascript,php,html,css,codeigniter

Problem :

My problem is that i cant seem to load my .css and .js files on my other views. The only single view that can access .css and .js files is my default_controller's index() function. The destination folder doesn't have any problem though because it can be accessed by the index function.

I want my .css and .js files be accessible to all my views.

Solution :

Add the following link to your header file

 <script src="<?php echo base_url() ?>js/hello.js" type="text/javascript" charset="utf-8"></script>

 <link rel="stylesheet" href="<?php echo base_url() ?>css/hello.css" type="text/css" charset="utf-8" />

For css

 make the folder in codeigniter folder like following

For js

 make the folder in codeigniter folder like following

    CSS Howto..

    TW Bootstrap: How to overflow columns

    I applied CSS auto-resizing to image, now how do I push it to the background?

    How to change nested divs within a named div to display as display:inline using CSS or jQuery selectors?

    how to dynamically change css class for html form elements based on other css class

    How can I make my form autoscale correctly?

    How to align a Wordpress navigation bar to the right of a logo?

    How to make a CSS shape with rounded and straight edges?

    How to call particular CSS file only for desktop not for mobile [closed]

    How to Drop 2 nested shadows On 2 Divisions in CSS? [closed]

    How to add link without ruining transition CSS/HTML

    how to change browsers default scrollbar using css or jquery

    How can I show a element on my site when hovered with only JS?

    how to always display empty tags, is there a css property for this?

    how do I select a single tag in the middle of many of the same in CSS?

    How to remove unwanted whitespace css/html

    How to create vertical tabs in firefox addon?

    Text-only CSS slideshow

    Show nav once the nav has been hidden

    How to build a hover effect with css only, or css+jquery

    How to size relative div which haven't a content?

    How to Make 4 cells in each line by only css & html

    How to change css dynamic by javascript

    How to force a browser to show the latest changes to a CSS file?

    Extjs: how Element's up/down functions work?

    CSS: How to align table data

    How to include multiple Css Class in ActionLink?

    how to avoid the ID name in css file

    CSS Selectors - How to apply a defined class on the selector's event

    How to set my span text vertical align and next to my image?

    how to css absolute positioning right way