0

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?

4 Answers 4

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

0

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">

Comments

0

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.

Comments

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.