简体   繁体   中英

How to refer to css file in codeigniter?

I use XAMPP and CI 2.14 (I know it's sounds ridiculous, but...) I don't know how to refer to a css file from a view. I've read and tried a lot of examples but, obviously I do something wrong...

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

The base url is: http://localhost/myapp/

Where should I put then main.css file (now is in the webroot/myapp/css folder), and how to reference it from a codeigniter view?

create folder assets:

path is: /assets/css/your_file.css

<link rel="stylesheet" href="/assets/css/your_file.css" type="text/css" />

Try to put the css folder inside the application folder, like this:

/yourapp/application/css/

And then

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM