sharin gan
sharin gan

Reputation: 383

why does my css nor html load in codeigniter?

When I include the following code within my view file:

<link rel="stylesheet" href="<?php echo base_url();>css/libs/animate.min.css" type="text/css" media="all">

<!-- Font Awesome icon library -->
<link href="<?php echo base_url();?>css/libs/font-awesome.min.css" rel="stylesheet" type="text/css" media="all">

<!-- Load primary stylesheet -->
<link rel="<?php echo base_url();?>stylesheet" href="css/skin.css" type="text/css" media="all">

Nothing loads not even HTML content, but when I remove these lines HTML content loads properly. So how do I load my CSS files? They are in my assests/css

Upvotes: 0

Views: 84

Answers (3)

Pawan Kumar Sharma
Pawan Kumar Sharma

Reputation: 221

you did mistaken to close the php script in first css linking you wrote .

 <?php echo base_url();> 

instead of

<?php echo base_url();?>

and also check that you have loaded url helper in your code or not ? use this

 <link rel="stylesheet" href="<?php echo base_url();?>css/libs/animate.min.css" type="text/css" media="all">//mistake in this line missing '?'

    <!-- Font Awesome icon library -->
    <link href="<?php echo base_url();?>css/libs/font-awesome.min.css" rel="stylesheet" type="text/css" media="all">

    <!-- Load primary stylesheet -->
    <link rel="<?php echo base_url();?>stylesheet" href="css/skin.css" type="text/css" media="all"> 

Upvotes: 0

Abdulla Nilam
Abdulla Nilam

Reputation: 38670

in config.php]

$autoload['helper'] = array('url');

and base_url() should

$config['base_url'] = '';

Upvotes: 0

Arvind Jaiswal
Arvind Jaiswal

Reputation: 442

You have to load helper in config/autoload.php

$autoload['helper'] = array('url', 'file','form');

Upvotes: 1

Related Questions