我无法在CodeIgniter中获得CSS设置,生活在我所做的更改之下。有没有人能帮我解决哪里出了问题?
文件autoload.php
$autoload['helper'] = array('html','text');主文件夹控制器中的文件
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller{
public function __construct() {
parent::__construct();
}
public function index(){
$this->load->view('html_header');
$this->load->view('cabecalho');
$this->load->view('corpo');
$this->load->view('rodape');
$this->load->view('html_footer');
}
}我在路径/ css / teste.css中创建了以下css文件夹
在文件夹视图中创建的php文件
cabecalho.php corpo.php rodape.php html_header.php html_footer.php
html_header.php文件夹并将这行代码放入
<?php echo doctype('xhtml1-trans'); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Meu website de receitas</title>
<?php
$meta = array(
array('name' => 'robots', 'content' => 'no-cache'),
array('name' => 'description', 'content' => 'Meu website de receitas'),
array('name' => 'keywords', 'content' => 'Receitas, doces, salgados, sobremesas, massas'),
array('name' => 'robots', 'content' => 'no-cache'),
array('name' => 'Content-type', 'content' => 'text/html; charset=utf-8', 'type' => 'equiv')
);
echo meta($meta);
echo link_tag('caminho/css/teste.css');
?>
</head>
<body>teste.css该文件夹具有以下配置
#cabecalho{background-color: #ddd; float: left; width: 824px; margin-bottom: 10px; padding: 5px;}因为它不起作用。
发布于 2014-05-22 08:19:48
当你有像first这样的css时:
<?php echo base_url(); ?>/css/style.css
css文件夹应该在根目录中,然后才能申请。
发布于 2014-04-07 20:33:29
你需要像这样添加你的css (如果css目录在CI的根目录上)
echo link_tag('css/teste.css');else (如果css目录在其他目录下)
echo link_tag('other/css/teste.css');更多信息请关注:- css并尝试ctrl+u或查看源码is css path is ok
https://stackoverflow.com/questions/22912119
复制相似问题