html - CodeIgniter CSS 不会链接到 html

标签 html css codeigniter

我不明白为什么我的 css 不会链接到 html 文件。我已经尝试过代码段中显示的在线示例,但是这两个选项都不起作用。当我在浏览器中加载 localhost 文件夹时,html 页面肯定显示为文本“root-container”。任何帮助都会很棒!

尝试在链接前添加“应用程序”似乎也无济于事。例如。 '应用程序/ Assets /样式/navigation.css'。

此外,helper 和 url 已添加到自动加载配置文件中。

基本网址

$config['base_url'] = 'http://localhost/mysite/';

元素结构

省略根文件夹。假设根文件夹名称是“mysite”。所以我的网站 -> 应用程序 -> ...

enter image description here

HTML

<!DOCTYPE html>
<html>

<head>
  <meta charset = "utf-8">

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

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

  <?php echo link_tag('assets/style/navigation.css'); ?>

</head>

<body>
  <div class = "root-container">
    root-container


  </div>
</body>

</html>

CSS

html {
 margin: 0 auto;
 padding: 0px;
}

body {
  margin: 0 auto;
  padding: 0px;
}

.root-container {
  width:100%;
  height:60px;
  border-bottom: 2px solid grey;
  background-color: black;
  color: red;

}

.root-container p {
  color:red;
  text-decoration: line-through;
}

添加请求的图片

enter image description here

结果 文本应该是红色的,并且有划线穿过它。

enter image description here

最佳答案

okey,您将 Assets 文件移动到主目录并将 application/assets/style/navigation.css 编辑为 assets/style/navigation.css

关于html - CodeIgniter CSS 不会链接到 html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51867024/

相关文章:

html - 你如何通过覆盖它从 Bootstrap 中完全删除样式

jQuery .load 方法导致页面刷新 AJAX

JavaScript:无法获取方 block 中的 rgb 颜色

html - 为什么我的按钮的位置会影响我的列表的位置?

php - 更新两个表 Codeigniter

php - 代码点火器 : How to get data by ID and preview it (Where ID)

angularjs - float 标签不适用于输入类型的电子邮件

css - 使用 Bootstrap 面板和固定导航栏的 anchor 标记偏移

asp.net - 使用 CSS 对齐表中的 ASP 控件

php - Codeigniter - “下一步”按钮更改页面上的值和数据,但 "active"类不会更改