如何加载JS和CSS

编程入门 行业动态 更新时间:2024-10-15 14:18:26
本文介绍了如何加载JS和CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的CI比较新。因此,我不知道如何加载CSS和JS。我用Google搜索,但未成功

I am newer in CI. So I don't know how to load CSS and JS. I google it but do not success

CI代码

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

这是我的目录结构。需要任何配置,它的路径显示在浏览器中,如下所示,但未加载CSS。

This is my directory structure. Need any configuration for it and it path display in browser like below but it not loaded css.

localhost/codeIgniter/css/bootstrap-cerulean.css

需要任何帮助,请发表评论,如有需要,我会进一步提供帮助。 / p>

Required any help please comment I will help further if needed.

推荐答案

将css / js / images / etc文件夹放在根目录中。这样,您可以将CSS或任何资产添加到您的站点。如此简单。

Put your css/js/images/etc folders in your root directory. In this way you can add css or any assets to your site. As simple as that.

<?php echo base_url("css/style.css"); ?>

更新: 确保.htaccess文件允许访问这些文件夹。

UPDATE: Make sure .htaccess file allows access to these folders.

更多推荐

如何加载JS和CSS

本文发布于:2023-11-02 00:16:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550819.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:加载   JS   CSS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!