CodeIgniter Forums
ci how to load the css file in the view? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: ci how to load the css file in the view? (/showthread.php?tid=53196)



ci how to load the css file in the view? - El Forum - 07-14-2012

[eluser]shinianyijian[/eluser]
ci how to load the css file in the view?
My css folder in the root directory


ci how to load the css file in the view? - El Forum - 07-14-2012

[eluser]umefarooq[/eluser]
you can load css or js file in view like this

Code:
With CI 2.1.+
//css file
<link href="<? echo base_url('css_dir_path/css_file.css')?>" rel="stylesheet" />

//js file
<scrip+ src="&lt;? echo base_url('js_dir_path/js_file.js');?&gt;"> </scrip+>

or

Code:
With CI 2.1. less then
//css file
&lt;link href="&lt;? echo base_url()?&gt;css_dir_path/css_file.css" rel="stylesheet" /&gt;

//js file
<scrip+ src="&lt;? echo base_url();?&gt;js_dir_path/js_file.js"> </scrip+>



ci how to load the css file in the view? - El Forum - 07-15-2012

[eluser]shinianyijian[/eluser]
Thank you very much, I use the version is 2.1.2, I tried two methods are useful, do in a future version, only the &lt;link href = "&lt;? Echo off of the base_url ()? Css_dir_path / css_file.css "rel =" stylesheet "/&gt; can be used?


ci how to load the css file in the view? - El Forum - 07-15-2012

[eluser]umefarooq[/eluser]
yes both method will work in future versions


ci how to load the css file in the view? - El Forum - 07-15-2012

[eluser]shinianyijian[/eluser]
Well, I understand,thanks