简体   繁体   中英

CodeIgniter CSS will not link to html

I can't figure out why my css will not link to the html file. 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. 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'.

Also, helper and url have been added to the autoload config file.

BASE URL

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

PROJECT STRUCTURE

Omitting root folder. Assume root folder name is 'mysite'. So mysite -> application -> ...

在此处输入图片说明

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

Adding requested image

在此处输入图片说明

result Text should be red and have line scored through it.

在此处输入图片说明

okey,您将资产文件移动到主目录,然后将application / assets / style / navigation.css编辑到资产/style/navigation.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