Search code examples
csscodeigniterdirectory-structure

codeigniter and adding stylesheets


I add a stylesheet to codeigniter:

<head>
<meta charset="utf-8">
<title>Site Administrator</title>
    <link rel="stylesheet" href="../../css/administrator.css" type="text/css" ></link>

</head>

But the rules arent added. I go two directories up and go to the css.. The direction of the href is right.. I used the autocomplete feature in netbeans.. But why no rules are added to the page? is it codeigniters problem?

My rules in the stylesheet:

        #container
        {
           margin: 0px auto;
           width:50%;
           background-color: #99BC99;
        }

        #container:first-child
        {
           text-align: center;
        }

        #heading
        {

            text-align: right;

        }
        h2
        {
            float:right;
            margin-right: 130px;
        }
        a
        {
            text-decoration: none;
        }

My html:

<div id="container">
<h1>ממשק מנהל</h1>
<div id="heading">

      <h2>  
        <?php echo anchor('news/local/123', 'צור נושא', 'title="News title"'); ?>
            </h2>
        <h2>  
            <?php echo anchor('news/local/123', 'הוסף אמייל', 'title="News title"'); ?>
        </h2>
        <h2>  
            <?php echo anchor('news/local/123', 'שנה שם וסיסמה', 'title="News title"'); ?>
        </h2>

</div>

UPDATE:

This is what it gives me:

This is what it gives me:  <link rel="stylesheet" href="http://localhost/finance_site/index.php/css/administrator.css" />

Whenever, I do this:

  <link rel="stylesheet" href="<?=site_url('css/administrator.css');?>" /> 

Alright, I got it, it is like this:

   <link rel="stylesheet" href="http://localhost/finance_site/css/administrator.css" /> 

Is there a way to re-write it so it will be a relative link to code igniter...or at least more portable?


Solution

  • use href="<?php echo base_url();?>css/administrator.css