I am trying to fit a stylesheet into view with CodeIgniter, please bare in mind I am new to CI.
So the stylesheet seems to be included right and I am checking the location, but it still doesn’t seem to change a thing..
this is my view:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>newsletter</title>
<link rel="stylesheet" href="<?php echo base_url(); ?>application/css/style.css" media="screen" />
</head>
<body>
<label for="name"> HI TESTING STYLING & EMAILING</label>
<div id="newsletter_form">
<?php echo form_open('email/send'); ?>
<?php
$name_data = array(
'name' => 'name',
'id' => 'name',
'value' => set_value('name')
);
?>
<p><label for="name">Name: </label> <?php echo form_input($name_data); ?></p>
<p><label for="email">Email Address: </label><input type="text" name="email" id="email" value="<?php echo set_value('email'); ?>">
<p><?php echo form_submit('submit', 'Submit'); ?></p>
<?php echo base_url(); ?>application/css/style.css
<?php echo validation_errors('<p class="error">'); ?>
<?php echo form_close(); ?>
</div>
</body>
</html>
as you can see I am echoing out the url just to make sure and it is correct although it is forbidden.. not sure if this is standard CI procedure or if this is the cause.. I am working on my localhost.
and this is my stylesheet…
label{
display: block;
background: #FFF;
}
.error{
color: #373737;
}
#newsletter_form{
background: #000;
width: 100px;
}
input[type=submit]{
border: 1px solid #c62828;
background: #aa2929;
color: #e3e3e3;
padding: .5em;
cursor: pointer;
}
input[type=submit]:hover{
background: #9c2222;
}
thanks!! I am confused, any help is appreciated 🙂
It is not good practice to put css/js files in your applications folder. Put it in a separate folder called “css” in your root and call it with
base_url('css/style.css');Your root folder should look like thisIt is good if CodeIgniter is blocking Application/Css because that means it’s protecting your raw files in your application folder properly 🙂