user3410718
user3410718

Reputation: 9

css not linking to html file in codeigniter

I am new to CI , to test how it works i started by making css file an then a html file, but the problem is that i cannot link my css file to the html one.
This is my html:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="code/application/style/style.css">
<title>Insert title here</title>
</head>
<body>
 Hi
</body>
</html>

This is my css:

body
{
    background-color: black ;
}

Upvotes: 0

Views: 97

Answers (2)

Mudshark
Mudshark

Reputation: 3253

Images, css files etc need to reside outside the application folder, preferably in an "assets" folder that is located on the same level. You can then link to them in your views like so:

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

Your folder structure would be:

ci-project
-index.php
-application
-assets
--css // --> style.css
--img // --> logo.png

Upvotes: 1

Julie24
Julie24

Reputation: 279

Maybe ?:

<link rel="stylesheet" href="../code/application/style/style.css">

Upvotes: 0

Related Questions