1

I'm working with CodeIgniter and I'm trying to use some stylesheets.

In my autoload.php I have $autoload['helper'] = array('html','url');

and on my view page I have

<link rel="stylesheet" src="<?php echo base_url('assets/css/bootstrap.css')?>"/>
<link rel="stylesheet" src="<?php echo base_url('assets/css/bootstrap-theme.css')?>"/>
<script src="<?php echo base_url('assets/js/jquery-2.2.4.js')?>"></script>
<script src="<?php echo base_url('assets/js/bootstrap.js')?>"></script>

I'm attempting to use stylesheets from Bootstrap, to make a nav bar appear.

Here is my navbar:

    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">
                    <img alt="Brand" src="...">
                </a>
            </div>
        </div>
    </nav>

The problem is the CSS doesn't seem to be working at all.

When I look at the page source, the proper links are included to the stylesheets in my <head></head> tags, but I get no change on the page itself.

4
  • 1
    check the console | network tab.probably css file isn't loaded Commented Jul 13, 2016 at 17:35
  • @FastSnail What should I be looking for? It seems that only my javascripts are coming up, I don't see any css files in there. But the links for them when I go into my page source is correct. What should I do? Commented Jul 13, 2016 at 17:38
  • network tab in browser console show all files loaded in to your page.so you can see 404 error red mark if some files are missing Commented Jul 13, 2016 at 17:39
  • You are missing the type also type="text/css" Commented Jul 14, 2016 at 0:51

1 Answer 1

4

src should be href.read more

don't use src for link tag

<link rel="stylesheet" href="<?php echo base_url('assets/css/bootstrap.css')?>"/>
Sign up to request clarification or add additional context in comments.

4 Comments

Beat me to it! Nice spot.
What a way to feel stupid. Did it used to be src? I found the code in question here stackoverflow.com/questions/20697954/…
It's src for <script> tags, which is probably why you were confused.
@GrumpyCrouton it is probably mistake

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.