radiopassive
radiopassive

Reputation: 566

How to load css files in codeigniter?

How can I load the css file in views/css/stylesheet.css in CI? My index file is in views/firstView.php

I am completely new to code igniter. Thought editing the config.php like this would work:

$config['index_page'] = 'localhost/Projects/first_CI/application/views/firstView.php';

but its not working :( . Can anyone suggest anything?

Upvotes: 0

Views: 659

Answers (4)

Kedar B
Kedar B

Reputation: 784

Try like this..

<link rel="stylesheet" type="text/css" href="<?php echo base_url()."css/style.css";?>">

Create css folder at the root and put css file in that folder.

Upvotes: 0

jollywing
jollywing

Reputation: 1

If your style.css is placed under the static directory which is located in your website root directory, you can refer it by:

<link rel="stylesheet" type="text/css" href="/static/signup.css">

Upvotes: 0

ABorty
ABorty

Reputation: 2522

put a css folder in your root directory and inside the folder put your css files.

now in firstView.php filr include the css like

<link rel="stylesheet" type="text/css" href="<?=base_url()?>css/style.css" title="" charset="utf-8">  //if your css file is style.css otherwise change style.css with yours

please let me know if you face any problem.

Upvotes: 2

jayadevkv
jayadevkv

Reputation: 372

I suggest you to watch some youtube videos on codeigniter .Css files are not added like that You have to set asset_url() function ,create folder assets in application directory and put css in that folder and include it , thats the recdomended method

Upvotes: 1

Related Questions