I have make a assets folder in root directory where application folder exist. now I have assets sibling to application.
Now when I tried to open http://localhost/CodeIgniter/assets/css/bootstrap.min.css
in web-page it's not working.
Do someone can help me how I can got it worked.
In a solution I found that writing this line in config file will work but it's not work either by doing this change.
$config['base_url'] = 'http://localhost/CodeIgniter/';
Now please some guideline me how to load CSS file in CI.
solution :-
I have done something wrong in my codeigniter project. I download it again and try these thing again, without anything it's working.
thanks you all of guys. you save my time.
Adding JavaScript and CSS (Cascading Style Sheet) file in CodeIgniter is very simple. You have to create JS and CSS folder in root directory and copy all the . js files in JS folder and . css files in CSS folder as shown in the figure.
You can add css styling to a page generated by php just the same as you would an ordinary html page. Typically you would link to a style sheet in the head section, or put the styling in <style> tags within the head. But you need to be more specific about what your needs are.
By using link_tag() function, we can add stylesheet files i.e css files into templates. Suppose, style. css file is inside /public/css folder.
In Solution Explorer, right-click the name of the Web site, and then click Add New Item. In the list of templates, select Style Sheet. In the Name box, type Layout. css, and then click Add.
In constant.php:
define('URL','http://localhost/CodeIgniter/');
define('IMG',URL.'assets/img/');
define('CSS',URL.'assets/css/');
define('JS',URL.'assets/js/');
In config.php:
$config['base_url'] = URL;
In view:
<link rel="stylesheet" href="<?php echo(CSS.'bootstrap.min.css'); ?>">
Hope that helps somewhat.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With