![]() |
CSS won't load - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: CSS won't load (/showthread.php?tid=60006) |
CSS won't load - El Forum - 12-26-2013 [eluser]Friedebarth[/eluser] I just got started again with CodeIgniter and decided to transfer the default CSS from /application/views/welcome_message.php into an external stylesheet at /assets/styles/style.css So, I removed the style from the header and replaced it with this: Code: <link rel="stylesheet" href="<?php echo base_url();?>assets/styles/style.css" type="text/css" media="screen" /> However, that just completely breaks the page. As in, I don't even get any unstyled content, the page just turns up blank. If I try just entering the URL normally (http://localhost/ci/assets/styles/style.css), I do get the content, but the style is ignored. What's going on here? CSS won't load - El Forum - 12-26-2013 [eluser]Tpojka[/eluser] Look in your '.htaccess' file. In 'RewriteCond' add file/folder you want to be able to access: Code: RewriteEngine on CSS won't load - El Forum - 12-26-2013 [eluser]InsiteFX[/eluser] Your missing the closing php tags. Second you do not need to add that RewriteCond to the .htaccess file if your application is configured correctly. CSS won't load - El Forum - 01-06-2014 [eluser]jonez[/eluser] You don't need to modify your .htaccess, base_url takes a relative path as a parameter, try this: Code: <link rel="stylesheet" href="<?=base_url( 'assets/styles/style.css' )?>" type="text/css" media="screen" /> CSS won't load - El Forum - 01-06-2014 [eluser]Rolly1971[/eluser] it depends on how the server is configured as to weather or not you need to add the rewrite condition. I know on my server i had to add that in order to load my assets such as javascripts, css, and images that are stored outside the application/views folder. Works fine if everything is inside the views folder but for me i have a 'themes' folder at the same level as the application folder and the only way i could load the assets was to add the rewrite condition in the .htaccess file. CSS won't load - El Forum - 01-06-2014 [eluser]jonez[/eluser] [quote author="Rolly1971" date="1389027878"]it depends on how the server is configured as to weather or not you need to add the rewrite condition. I know on my server i had to add that in order to load my assets such as javascripts, css, and images that are stored outside the application/views folder. Works fine if everything is inside the views folder but for me i have a 'themes' folder at the same level as the application folder and the only way i could load the assets was to add the rewrite condition in the .htaccess file. [/quote] This line: Code: RewriteCond $1 !^(index\.php|images|robots\.txt|assets) If you use a rewrite like this: Code: RewriteCond %{REQUEST_FILENAME} !-f CSS won't load - El Forum - 01-06-2014 [eluser]InsiteFX[/eluser] Code: <IfModule mod_rewrite.c> CSS won't load - El Forum - 03-06-2014 [eluser]InsiteFX[/eluser] Here's mine: Code: ::selection{ background-color: #E13300; color: white; } assets/css/codeigniter.css Code: <link rel="stylesheet" href="<?php echo base_url('assets/css/codeigniter.css'); ?>" type="text/css" media="screen" /> |