[eluser]kkoncept[/eluser]
I did a search and saw several threads that came close to answering my question but didn't quite get there. I'm trying to link to an external style sheet with the following code in my view file using base_url():
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<title><?=$title?></title>
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>css/styles.css" />
</head>
<body>
<div class="header"><img src="<?php echo base_url();?>images/logo.gif" alt="LOGO" /></div>
<br />
<div class="content">Some content here</div>
</body>
</html>
My directory structure is
Code:
/public_html
..css
..images
..system
and my controller code is this:
Code:
<?php
class Home extends Controller {
function Home()
{
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
}
function index()
{
$data['title'] = 'Welcome';
$this->load->view('home_view', $data);
}
}
?>
Everything seems to be working except that the css isn't getting applied. As you can see, I am using the same technique to link to my images folder. The weird part is that it works for the images folder but not the css folder.
Could the problem be in the css file itself? The code for that is here:
Code:
#header {
background-image: /images/headerbg.gif;
}
#content {
font-style: italic;
}
Thanks in advance for any enlightenment.