2

I have this code

<link href = "<?php echo base_url(); ?>css/style.css” rel=”stylesheet" type="text/css" />

which supposed to load the style.css from the css folder. The echo base_url() itself works. I also have autoloaded the url helper, so i really don't see the problem here, but it still doesn't load.

3
  • Open the url given in the Source Code and give us the error here. My bets are that your .htaccess isn't correct. Commented Jul 13, 2012 at 12:10
  • Are you sure that your css folder is located in your website root? Commented Jul 13, 2012 at 12:12
  • It seems that after this " charcter i used ” this and it didn't match. So it really was a typo. Source Code view showed it. Commented Jul 13, 2012 at 12:40

5 Answers 5

2

Also make sure that the directory is not "blocked" by the .htaccess file, if you are using it to remove index.php

RewriteEngine on
RewriteCond $1 !^(index\.php|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Personally I would move the css diectory into an assets directory:

/assets/css
/assets/js
/assets/img
Sign up to request clarification or add additional context in comments.

Comments

2

the default location for css files is the same level as the application i.e.,

/css
/application

Check the path as has been suggested.

Comments

1

View the source of the page and click the css file link, if it 404s then check your .htaccess file and make sure that that directory is available!

Comments

0

try including the relative link in the function like on the user_guide

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

Comments

0

application/views/globals/css/style.css" type="text/css" media="screen" />
or whatever your folders srtucture is!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.