Html 无法在codeigniter中加载css文件

Html 无法在codeigniter中加载css文件,html,css,codeigniter,Html,Css,Codeigniter,我是codeigniter的新手,并试图学习它,但我无法加载或使用css样式表进行布局。我在互联网上找到了加载CSS文件的方法,但它不起作用。请提出一些建议 这是我的代码: <html> <head> <title>homePage</title> <!--[if lte IE 6]> <style type="text/css"> img, div { behavior: url(http('<

我是codeigniter的新手,并试图学习它,但我无法加载或使用css样式表进行布局。我在互联网上找到了加载CSS文件的方法,但它不起作用。请提出一些建议

这是我的代码

<html>

<head>
<title>homePage</title>

 <!--[if lte IE 6]>
    <style type="text/css">
    img, div { behavior: url(http('<?php echo $base_url; ?>images') }
    </style>
<![endif]-->


<!--[IF lte IE 6]>

<link rel="stylesheet" href="<?php echo $base_url; ?>/css/homestyle.css" type="text/css" />

<![endif]-->
</head>

 <body >


 <div id="page">
 <div id="menulinks">
    <a class="active" href="#"><span>Home</span></a>
    <a href="#"><span>Services</span></a>
    <a href="#"><span>About Us</span></a>
    <a href="#"><span>Contact Us</span></a>
</div>
<div id="header">

</div>
          <div class="active" id="contentarea">
  <br>
 <br> 
 </div>

 </div>
</body>

</html>

主页



这是一条注释,大多数浏览器不会解析其中的内容。它仅在IE下可用。您需要将
放在注释之外:

<link rel="stylesheet" href="<?php echo $base_url; ?>/css/homestyle.css" type="text/css" />
HTML包装在

在您的评论之后编辑: 是的,我想你已经从你的问题中定义了这个变量。进入
config/autoload.php
并将
'url'
键添加到
$autoload['helper']
数组:

例如:
$autoload['helper']=array('url','file','your_other_helpers…')


然后将上面的HTML更改为
你把css文件放在哪里了?我的css文件在我的www/codeiginitor/res/css/style.cssres文件夹中,css文件夹由我制作,我把样式表放在其中。在视图文件中,我是这样写的。我现在已经在我的视图文件中这样写了这个标记。。但它仍然不起作用。我的css文件在:www/codeignitor/res/css/homestyle.css中,它一定是有路径的。尝试/在开始时
href=“/res/css/homestyle.css”
现在我的css样式已加载,但我无法看到我的背景图像。我的图像在css文件中#标题{宽度:900px;高度:119px;背景图像:url(/images/header.png);顶部填充:70px;底部填充:8px;右侧填充:-20px;}但未加载它们。。images文件夹位于www/codeignitor/images中,我错了。图像路径必须相对于css位置。如果css文件是
ww/codeignitor/res/css/
ww/codeignitor/images
中的图像,这意味着css文件的相对路径是
。/../images/
,它应该如下所示:
背景图像:url(../../images/header.png)<link rel="stylesheet" href="<?php echo $base_url; ?>/css/homestyle.css" type="text/css" />
 <head>
    <title>homePage</title>
    <base href="<?= $base_url;?>">
    <!--[if lte IE 6]>
        <style type="text/css">
            img, div {
                behavior: url(images);
            }
        </style>
    <![endif]-->
    <link rel="stylesheet" href="css/homestyle.css" type="text/css" />
</head>