Reputation: 251
I am facing a problem while trying to load css in template/header.php and footer.php and facing problems while doing this.
structure of my codeignitor application is
-application
-views
-- css (folder)
--- style.css
-- template (folder)
---header.php
In header.php I am using the following line to load css
<style> @import url('<?=base_url()?>css/style.css'); </style>
In web console I am seeing it as
GET http://localhost/groce/css/style.css [HTTP/1.1 404 Not Found 1ms]
where groce is name of my application
Upvotes: 0
Views: 160
Reputation: 1003
Try Correct one::
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>css/style.css">
Structure::
-application
-css
-system
Upvotes: 0
Reputation: 2995
Try this:
<link rel="stylesheet" href="<?=site_url('css/style.css');?>" type="text/css"/>
And you need application structure something like this:
-application
-css
-system
index.php
.htaccess
Also need add css folder to rewrite condition in .htaccess
RewriteCond $1 !^(index\.php|css)
Upvotes: 1