简体   繁体   English

CodeIgniter CSS将不会链接到html

[英]CodeIgniter CSS will not link to html

I can't figure out why my css will not link to the html file. 我不知道为什么我的CSS不会链接到html文件。 I've tried examples online as shown in the code segments, but neither options work. 我已经在线尝试了示例,如代码段所示,但是这两个选项都不起作用。 The html page definitely shows as the text 'root-container' is present when I load the localhost folder in the browser. 当我在浏览器中加载localhost文件夹时,html页面肯定显示为文本“ root-container”。 Any help would be great! 任何帮助将是巨大的!

Trying to add 'application' before the link does not seem to make a difference either. 尝试在链接之前添加“应用程序”似乎也没有什么不同。 Eg 'application/assets/style/navigation.css'. 例如“应用程序/资产/样式/navigation.css”。

Also, helper and url have been added to the autoload config file. 另外,helper和url已添加到自动加载配置文件中。

BASE URL 基本网址

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

PROJECT STRUCTURE 项目结构

Omitting root folder. 省略根文件夹。 Assume root folder name is 'mysite'. 假设根文件夹名称为“ mysite”。 So mysite -> application -> ... 所以mysite-> application-> ...

在此处输入图片说明

HTML 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 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;
}

Adding requested image 添加请求的图像

在此处输入图片说明

result Text should be red and have line scored through it. 结果文本应为红色,并在其中划过一行。

在此处输入图片说明

okey,您将资产文件移动到主目录,然后将application / assets / style / navigation.css编辑到资产/style/navigation.css

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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