doulizhi1247 2013-08-20 14:39
浏览 53
已采纳

无法在codeigniter平台中加载css

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

  • 写回答

2条回答 默认 最新

  • douxie1692 2013-08-20 14:45
    关注

    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)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?