Welcome Guest, Not a member yet? Register   Sign In
Can't get css to work
#1

[eluser]cerberus478[/eluser]
Hi I'm not sure if this is the right forum, but for some reason my css doesn't want to work. I think I'm doing something silly but I can't seem to figure it out.
I'm using MAMP as my localhost.

Code:
<!DOCTYPE html>
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Bootstrap 101 Template&lt;/title&gt;
    &lt;meta name="viewport" c initial-scale=1.0"&gt;
    &lt;!-- Bootstrap --&gt;
    &lt;link href="css/bootstrap.min.css" rel="stylesheet"&gt;
   &lt;!-- &lt;link href="/css/style.css" rel="stylesheet"&gt;--&gt;
    &lt;link href="&lt;?php echo base_url("css/style.css"); ?&gt;css/style.css" rel="stylesheet"&gt;

    &lt;!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --&gt;
    &lt;!-- WARNING: Respond.js doesn't work if you view the page via file:// --&gt;
    &lt;!--[if lt IE 9]>
      [removed][removed]
      [removed][removed]
    <![endif]--&gt;
  &lt;/head&gt;
  &lt;body&gt;
    <h1>Hello, world!</h1>
    
    blah blah

    &lt;!-- jQuery (necessary for Bootstrap's JavaScript plugins) --&gt;
    [removed][removed]
    &lt;!-- Include all compiled plugins (below), or include individual files as needed --&gt;
    [removed][removed]
  &lt;/body&gt;
&lt;/html&gt;
#2

[eluser]CroNiX[/eluser]
Either of these 2 should work:
Code:
&lt;link href="/css/style.css" rel="stylesheet"&gt;
&lt;link href="&lt;?php echo base_url('css/style.css'); ?&gt;" rel="stylesheet"&gt;

Assuming:
-/application
-/css
-/system
-index.php

Notice the CSS dir is in the root dir of the site and not within /application or /system.
#3

[eluser]vamsisnikky[/eluser]
use
&lt;?php $this->load->helper('url'); ?&gt;
&lt;link href="&lt;?php echo base_url(); ?&gt;css/style.css" rel="stylesheet"&gt;

You have to lode helper('url') then only base_url(); works
this will defanatly gets ur css




Theme © iAndrew 2016 - Forum software by © MyBB