molnard molnard - 1 month ago 7x
PHP Question

CodeIgniter - css file doesn't work

I have problem with css file in CodeIgniter framework. In my autoconfig file I load url and html helper. In view I have code:

<?php echo link_tag('application/assets/css/style.css')?>

but this code doesn't work. In config file my base_url is
. My directory structure is

I try

<link rel="stylesheet" type="text/css" href="<?=base_url()?>application/assets/css/style.css"/>


<link rel="stylesheet" type="text/css" href="<? echo base_url('application/assets/css/style.css')?>"/>

but this also doesn't work.


Put your asset folder in project root, out side application folder.

Change the link to,

<?php echo link_tag('assets/css/style.css')?>

CI Folder Structure

enter image description here