Welcome Guest, Not a member yet? Register   Sign In
Codeigniter + CSS not working well, possible baseurl
#1

[eluser]Unknown[/eluser]
This question has been asked several times, but I researched and still can't solve it. In one of my view file, I have (referencing to my css):

link rel="stylesheet" type="text/css" href="/application/views/screen.css"
The css file is in:

- www
- application
- view
- css
- screen.css
- system
I also tried to setup the css in the same folder under -www and use it directly by
- www
- application
- view
- css
- screen.css
- system
link rel="stylesheet" type="text/css" href="css/screen.css"
or
link rel="stylesheet" type="text/css" href="/css/screen.css"
both doesn't work
My base url is set to "" because I develop locally. Is this the issue? I'm Using wamp server.
#2

[eluser]apodner[/eluser]
Typically, I create an "assets" directory for files that need to be accessed.

-application
-system
-assets
--images
--scripts
--styles

the rule of thumb is usually that all file references are based upon the index.php file. In theory, this means you would access an image via "assets/images/imageName.jpg"

When I am building stylesheet and javascript links, I usually do the following:


<link rel="stylesheet" type="text/css" href="<?=base_url()?>assets/styles/style.css" />


Never had any problems with it when I do it this way.

You might also consider setting up for multiple environments. Have your base url set one way for development and another for production. http://ellislab.com/codeigniter/user-gui...ments.html



#3

[eluser]Aken[/eluser]
The application folder has an .htaccess in it that denies any HTTP requests to that folder. As apodner recommended, your static assets work better in their own directory.
#4

[eluser]ramirors[/eluser]
Are you using .htaccess (to remove index.php) on your webroot?
#5

[eluser]nishant1234[/eluser]
go to the site www.w3schools.com its really helpful




Theme © iAndrew 2016 - Forum software by © MyBB