Reputation: 309
I have a big problem with css and codeigniter.. I am starting to think it is my permissions or am I going mad?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>test</title>
<link rel="stylesheet" href="<?php echo base_url(); ?>/css/style.css"
type="text/css" media="screen"/>
</head>
<body>
<?php echo base_url(); ?>css/style.css
This is my header file, and as you can see i've even echoed it out just to make sure it is right and it is, when I view source of the page it seems fine.. but somehow it is not doing anything, this is my css just to show you the background should be gray:
body{
background: #b6b6b6;
margin 0;
padding 0;
font-family: arial;
}
my base url is fine.. as it is echoed out and goes to the right place $config['base_url'] = 'http://localhost/block/application';
I am really going mad what could be going wrong?
ht access:
Deny from all
Upvotes: 1
Views: 15427
Reputation: 96
After trying so many things, what actually worked for me is to place the assets folder in the root directory NOT the application directory
Upvotes: 1
Reputation: 2025
you can use
<link rel="stylesheet" href="<?php echo base_url(); ?>css/style.css"
type="text/css" media="screen"/>
or
<link rel="stylesheet" href="<?php echo base_url('css/style.css'); ?>"
type="text/css" media="screen"/
Upvotes: 1
Reputation: 1
you must take the css folder or file and put it in the root directory not the application directory and use base_url function as i stated below
<link href="<?php echo base_url();?>site.css"
Upvotes: 0
Reputation: 8053
Don't have an htacess file with Deny From All in any resource folders.
You need to seperate out the css folder from the applications folder.
Upvotes: 0
Reputation: 4565
If you want base_url()
to output the proper url, simply pass in the path as a parameter.
base_url('path/to/stylesheet.css');
Upvotes: 2
Reputation: 6389
Add another /
in your link /css/style.css
<link rel="stylesheet" href="<?php echo base_url(); ?>/css/style.css"
type="text/css" media="screen"/>
Upvotes: 0
Reputation: 97672
If your base_url()
gives you http://localhost/block/application
then the path to the css file will look like http://localhost/block/applicationcss/style.css
, I think it should be http://localhost/block/application/css/style.css
, so you're missing a /
<link rel="stylesheet" href="<?php echo base_url(); ?>/css/style.css"
type="text/css" media="screen"/>
Upvotes: 0