CodeIgniter Forums
how to load the css - 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: how to load the css (/showthread.php?tid=56839)



how to load the css - El Forum - 01-24-2013

[eluser]darshanchalla[/eluser]
Hi,
My page is not able to load the css when i am trying to load the page with default controller like this way http://localhost/mysite/ like this way css is not loaded......
when i am trying to load the page like this way http://localhost/mysite/index.php/site/index
css is loaded perfectly.....and i have put all my css folder and image folder like in this
path C:\wamp\www\tt\assets\css and all other application path is in the root path of the
tt like c:\wamp\www\tt\application....plz give me solution as


how to load the css - El Forum - 01-24-2013

[eluser]Metamorphosis[/eluser]
Hi.

try this in your header.php

Code:
<link href="<?php echo base_url();?>assets/css/name_of_css_file.css" rel="stylesheet" type="text/css" />



how to load the css - El Forum - 01-24-2013

[eluser]PhilTem[/eluser]
Or try it more fail-safe

Code:
<link href="<?php echo base_url('assets/css/name_of_css_file.css');?>" rel="stylesheet" type="text/css" />

Many people seem to forget that base_url() and site_url() take an argument that will be taken care of leading slashes and stuff so you don't run into troubles with that Wink


how to load the css - El Forum - 01-24-2013

[eluser]Otemu[/eluser]
[quote author="PhilTem" date="1359027820"]Or try it more fail-safe

Code:
<link href="<?php echo base_url('assets/css/name_of_css_file.css');?>" rel="stylesheet" type="text/css" />

Many people seem to forget that base_url() and site_url() take an argument that will be taken care of leading slashes and stuff so you don't run into troubles with that Wink[/quote]

Fantastic I didn't even know that :-)


how to load the css - El Forum - 01-24-2013

[eluser]darshanchalla[/eluser]
[quote author="PhilTem" date="1359027820"]Or try it more fail-safe

Code:
<link href="<?php echo base_url('assets/css/name_of_css_file.css');?>" rel="stylesheet" type="text/css" />

Many people seem to forget that base_url() and site_url() take an argument that will be taken care of leading slashes and stuff so you don't run into troubles with that Wink[/quote]





thank you very much to all of u Big Grin