【问题标题】:Bootstrap 3.3.7 with codeigniter带有 codeigniter 的 Bootstrap 3.3.7
【发布时间】:2017-02-04 07:44:16
【问题描述】:

我正在尝试使用引导导航栏,但它不起作用。 我创建了一个模板文件夹,其中包含视图中首页的 CSS。 我的代码:

<!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">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">

        <title> TTS</title>
        <link rel="stylesheet" href="<?php echo base_url("asset/css/bootstrap.css"); ?>" />

        <style type="text/css"> 
            #img{
                display:block;
                position:relative;
                left:0px;
                float:left;
                margin-left:10px;
            }
            #img2{
                display:block;
                position:relative;
                right:0px;
                float:right;
                margin-right:10px;
            }
            #img3{
                display:block;
                position:relative;
                left:0px;
                float:left;
            }
        </style>
    </head>
    <body>
        <script type="text/javascript" src="<?php echo base_url("asset/js/jquery.js"); ?>"></script>
        <script type="text/javascript" src="<?php echo base_url("asset/js/bootstrap.js"); ?>"></script>
    </body>
</html>

视图的 php 文件是:

    <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">TTS</a>
            </div>
            <ul class="nav navbar-nav navbar-right">
                <li class="active"><a href="#">Home</a></li>
                <li><a href="#">Services</a></li>
                <li><a href="#">Contact</a></li>
            </ul>
        </div>
    </nav>

控制器是:

    <?php defined('BASEPATH') OR exit('No direct script access allowed');

    class firstpage extends CI_Controller {
        public function __construct() {     
            parent::__construct();
            $this->load->helper('url');
            $this->load->helper('html');
            $this->load->helper('form');
        }

        public function index(){
            $this->load->view('templates/front_template/front');
            $this->load->view('front_page/firstpage');
        }
    } ?>

我可以在this.searched 获得帮助吗?在没有得到正确答案的地方。

【问题讨论】:

标签: php css twitter-bootstrap codeigniter


【解决方案1】:

检查你的firefox firebug或开发者工具的url中是否有ip

$config['base_url'] = 'http://localhost/projectname/';

而你错过了type="text/css"

而且不需要用 ?>

关闭控制器

【讨论】:

  • 我已经从 " /> 中删除了 .to havea normal html and it works.same to the jquery script has removed
【解决方案2】:

我不确定这是否会有所帮助,但请尝试从该行中删除 echo

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

应该是这样的

<link rel="stylesheet" href="<?php base_url("asset/css/bootstrap.css"); ?>" />

【讨论】:

    猜你喜欢
    • 2014-06-20
    • 2018-05-07
    • 1970-01-01
    • 2017-06-27
    • 1970-01-01
    • 2018-11-11
    • 1970-01-01
    • 1970-01-01
    • 2018-11-04
    相关资源
    最近更新 更多