Codeigniter不会加载css表单文件

时间:2012-12-06 20:10:17

标签: css codeigniter

k所以我把所有的css都放在单独的文件中,但它不会加载,我将它放在根目录中名为css的文件夹中,并为每个视图分别提供css文件。它确实在主页上加载,但没有其他任何加载。

这是我在标题标记中尝试过的代码:

<link rel="stylesheet" type="text/css" href="/css/(name of file for specific view).css" />

<link rel="stylesheet" type="text/css" href="css/(name of file for specific view).css" />

<link rel="stylesheet" type="text/css" href="<?php base_url() ?>css/about.css" />

<link rel="stylesheet" type="text/css" href="<?php base_url('css/about.css') ?>" />

<link rel="stylesheet" type="text/css" href="<?php base_url().'css/about.css' ?>" />

<link rel="stylesheet" type="text/css" href="<?php base_url().'/css/about.css' ?>" />

<link rel="stylesheet" type="text/css" href="<?php echo base_url() . 'css/about.css' ?>" />

从root获取css的路径是:/ css /(文件名).css

我从根查看我的视图的路径是:/ applications / view /(文件名).php

我做错了什么?

我正在使用mod_rewrite运行codeigniter 2.1.3

编辑:

这是来自浏览器的源代码:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">

<title>The Groundscore Way</title>

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


</head>
<body>

<div class='site'>

    <div class='ban' >
        <img src="http://www.ground-score.com/imgs/gs_banner_med.JPEG" />
    </div>

    <div class='map'>
        <BR /><BR /><BR /><BR />
        <A HREF="http://www.ground-score.com/main/home" TITLE="home" ><img src="http://www.ground-score.com/imgs/home_0.png"></A>
        <BR />
        <A HREF="http://www.ground-score.com/main/about" TITLE="about" ><img src="http://www.ground-score.com/imgs/about_0.png" /></A>
        <BR />
        <A HREF="http://www.ground-score.com/main/members" TITLE="members" ><img src="http://www.ground-score.com/imgs/members_0.png" /></A>
        <BR />
        <A HREF="http://www.ground-score.com/main/news" TITLE="members" ><img src="http://www.ground-score.com/imgs/news_0.png" /></A>
        <BR />
        <A HREF="http://www.ground-score.com/main/blog" TITLE="blog" ><img src="http://www.ground-score.com/imgs/blog_0.png" /></A>
        <BR />
        <A HREF="http://www.ground-score.com/main/projects" TITLE="projects" ><img src="http://www.ground-score.com/imgs/projects_0.png" /></A>
        <BR />
        <A HREF="http://www.ground-score.com/main/portfolios" TITLE="portfolios" ><img src="http://www.ground-score.com/imgs/portfolios_0.png" /></A>
        <BR />
        <A HREF="http://www.ground-score.com/main/contact"TITLE="contact" ><img src="http://www.ground-score.com/imgs/contact_0.png" /></A>
        <BR />
        <BR /><a href=http://www.ground-score.com/main/login><img src="http://www.ground-score.com/imgs/log_in_0.png" /></a><BR /><a href=http://www.ground-score.com/main/signup><img src="http://www.ground-score.com/imgs/sign_up_0.png" /></a><BR />        </div>


    <div class='content'>



</div>


    <div class=cpwrt>

        <P> <span style="color:#ffffff;"> Copyright (c) 2012 ground-score.com. All rights reserved.</span> </P>

    </div>


</div>
</body>
</html>

<!-- Hosting24 Analytics Code -->
<script type="text/javascript" src="http://stats.hosting24.com/count.php"></script>
<!-- End Of Analytics Code -->

css文件代码:

        p 
{
    color:black;
    font-family:arial;
    line-height:130%;
}

body 
{
    background-image:url('/imgs/green_tex.jpg');
}

.ban
{
    position:absolute;
    top:20px;
    left:25%;
}
.map
{
    position:absolute;
    top:20px;
    left:5%;
    border-style:solid;
    border-color:black;
    width:130px;
    height:625px;
    padding:12px;
    border-width:1px;
    background:#9d1e15
}
h2
{
    text-align:center;
}
.content
{
    position:absolute;
    top:16%;
    left:25%;
    border-style:solid;
    border-color:black;
    padding:8px;
    border-width:1px;
    background:white;
    width:583px;
    height:542px;
}

.cpwrt
{
    position:absolute;
    top:97%;
    left:33%;

}

.site
{
    position:absolute;
    top:0px;
    left:0px;
    width:1200px;
    height:690px;
}

2 个答案:

答案 0 :(得分:0)

尝试<?php echo base_url() . 'css/about.css' ?>

如果这不起作用,我认为您的/ css目录中可能没有名为“about.css”的文件。 http://www.ground-score.com/css/home.css运行正常。 http://www.ground-score.com/css/about.css没有。

答案 1 :(得分:-1)

好的,它现在有效,我唯一的方法是键入https://和所有https://www.site.com/css/(file).css