0

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' ?>" />

从根目录到我的 css 的路径是:/css/(file name).css

从根目录到我的视图的路径是:/applications/view/(file name).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;
}
4

2 回答 2

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没有。

于 2012-12-06T21:55:37.660 回答
-1

好的,它现在可以工作了,这是我让它打字的唯一https://方法https://www.site.com/css/(file).css

于 2012-12-07T00:10:37.953 回答