0

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

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

13 Comments

pls paste last css link?
application/assets/style/navigation.css
open site and press ctrl + u and take screanshot and share
I've already added the helper to autoload. Thanks for the suggestion though.
Your suggestion to move the folder worked, thanks very much!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.