Chris
Chris

Reputation: 807

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. E.g. '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 -> ...

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

Adding requested image

enter image description here

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

enter image description here

Upvotes: 0

Views: 40

Answers (1)

Kaan
Kaan

Reputation: 167

okey , you move assets file to your main directory and edit application/assets/style/navigation.css to assets/style/navigation.css

Upvotes: 1

Related Questions