开发者

HTML not getting CSS

I am working on a codeigniter project. I am having a problem about css. the css are included in the header in the following fashion:

<link  href="http://localhost/ebookazine/assets/css/reset.css" rel="stylesheet" type="text/css" />
<link  href="http://localhost/ebookazine/asset开发者_JAVA百科s/css/typography.css" rel="stylesheet" type="text/css" />
<link  href="http://localhost/ebookazine/assets/css/FlashStatus.css" rel="stylesheet" type="text/css" />
<link  href="http://localhost/ebookazine/assets/css/webshop.css" rel="stylesheet" type="text/css" />

but no css links are working. someone help about this?


First of all, check if your .htaccess file looks something like this (especially the |assets| part is important):

rewriteengine on
rewritecond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

This allows that the files inside your assets folder can be accessed by public.

Next, make sure that the paths inside your view use the base_url() command, e.g.:

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

With that, the view will always use the correct absolute URL, no matter if you are testing it on your local machine or on a webserver.


Try copying the code found within the css files and creating new css files on your computer and then pasting the code(the code you just copied) into those files(the new files you just created). Make sure you put the new css files in the same folder as your html file. Then, simply link the css files in the following fashion:

<link rel="stylesheet" type="text/css" href="filename.css"/>

I honestly don't know why it's not working the way you're doing it at the moment; i would need to know more information in order to help you if you really want to leave the files where they currently are(in localhost).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜