简体   繁体   English

我无法在 codeigniter 中上传 style.css 页面,我希望在视图文件中使用该样式,如何在视图中包含 style.css?

[英]I am not able to upload style.css page in codeigniter and i want that styling in views file , how to include style.css in views?

I am not able to upload style.css page in codeigniter and i want that styling in views file , how to include style.css in views?我无法在 codeigniter 中上传 style.css 页面,我希望在视图文件中使用该样式,如何在视图中包含 style.css?

Here is my style.css page:这是我的 style.css 页面:

body {
    margin: 0;
    padding: 0;
    background: #f4f4f4;
    font: 14px;
    font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
}

.error {
    color: red;
}

.link {
    text-align: center;
    clear: both;
    padding: 20px 0;
}

    .link a {
        color: #333333;
    }

.wrapper {
    width: 960px;
    margin: 50px auto;
}

/* Form 1 style */

.form1 {
    width: 450px;
    /*float: left;*/
    background: #fff;
    color: #777;
    -webkit-box-shadow: 0px 0px 8px 2px #d1d1d1;
    -moz-box-shadow: 0px 0px 8px 2px #d1d1d1;
    box-shadow: 0px 0px 8px 2px #d1d1d1;
    -webkit-border-top-left-radius: 0px;
    -webkit-border-top-right-radius: 0px;
    -webkit-border-bottom-right-radius: 6px;
    -webkit-border-bottom-left-radius: 6px;
    -moz-border-radius-topleft: 0px;
    -moz-border-radius-topright: 0px;
    -moz-border-radius-bottomright: 6px;
    -moz-border-radius-bottomleft: 6px;
    border-top-left-radius: 0px;
    border-top-right-radius: 0px;
    border-bottom-right-radius: 6px;
    border-bottom-left-radius: 6px;
    overflow: hidden;
}

.formtitle {
    padding: 10px;
    line-height: 16px;
    font-size: 13px;
    text-shadow: -1px -1px #e87c19;
    color: #fff;
    font-weight: bold;
    border-bottom: 1px solid #eb8d19;
    width: 510px;
    background: #ffbd27; /* Old browsers */
    background: -moz-linear-gradient(top, #ffbd27 0%, #ffb119 50%, #ff9d19 51%, #ff9d19 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffbd27), color-stop(50%,#ffb119), color-stop(51%,#ff9d19), color-stop(100%,#ff9d19)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #ffbd27 0%,#ffb119 50%,#ff9d19 51%,#ff9d19 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #ffbd27 0%,#ffb119 50%,#ff9d19 51%,#ff9d19 100%); /* Opera11.10+ */
    background: -ms-linear-gradient(top, #ffbd27 0%,#ffb119 50%,#ff9d19 51%,#ff9d19 100%); /* IE10+ */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffbd27', endColorstr='#ff9d19',GradientType=0 ); /* IE6-9 */
    background: linear-gradient(top, #ffbd27 0%,#ffb119 50%,#ff9d19 51%,#ff9d19 100%); /* W3C */
}

.input {
    width: 510px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 10px;
    margin: 20px;
    overflow: hidden;
}

.inputtext {
    float: left;
    line-height: 18px;
    height: 35px;
    font-size: 14px;
    width: 155px;
}

.inputcontent {
    float: left;
    width: 290px;
    height: 40px;
}

    .inputcontent input {
        padding: 5px;
        height: 30px;
        width: 200px;
        line-height: 18px;
        border: 1px solid #c7c7c7;
        -moz-border-radius: 6px;
        -webkit-border-radius: 6px;
        border-radius: 6px;
        color: #777;
    }

    .inputcontent a {
        color: #0084ff;
        font-size: 12px;
        text-decoration: none;
        line-height: 12px;
    }

.nobottomborder {
    border-bottom: 0;
}

.orangebutton {
    background: #ffc339; /* Old browsers */
    background: -moz-linear-gradient(top, #ffc339 0%, #ff9b19 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffc339), color-stop(100%,#ff9b19)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #ffc339 0%,#ff9b19 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #ffc339 0%,#ff9b19 100%); /* Opera11.10+ */
    background: -ms-linear-gradient(top, #ffc339 0%,#ff9b19 100%); /* IE10+ */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffc339', endColorstr='#ff9b19',GradientType=0 ); /* IE6-9 */
    background: linear-gradient(top, #ffc339 0%,#ff9b19 100%); /* W3C */
    border: 1px solid #ff9b19;
    -webkit-border-radius: 20px;
    -moz-border-radius: 20px;
    border-radius: 20px;
    line-height: 20px;
    font-size: 16px;
    padding: 6px 12px;
    color: #fff;
    text-shadow: -1px -1px #ff9b19;
    float: right;
    margin-left: 10px;
    cursor: pointer;
}

    .orangebutton:hover {
        background: #ff9b19; /* Old browsers */
        background: -moz-linear-gradient(top, #ff9b19 0%, #ffc339 100%); /* FF3.6+ */
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ff9b19), color-stop(100%,#ffc339)); /* Chrome,Safari4+ */
        background: -webkit-linear-gradient(top, #ff9b19 0%,#ffc339 100%); /* Chrome10+,Safari5.1+ */
        background: -o-linear-gradient(top, #ff9b19 0%,#ffc339 100%); /* Opera11.10+ */
        background: -ms-linear-gradient(top, #ff9b19 0%,#ffc339 100%); /* IE10+ */
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff9b19', endColorstr='#ffc339',GradientType=0 ); /* IE6-9 */
        background: linear-gradient(top, #ff9b19 0%,#ffc339 100%); /* W3C */
    }

/* Form 2 Style */

.form2 {
    width: 510px;
    /*float: right;*/
    background: #fff;
    color: #777;
    -webkit-box-shadow: 0px 0px 8px 2px #d1d1d1;
    -moz-box-shadow: 0px 0px 8px 2px #d1d1d1;
    box-shadow: 0px 0px 8px 2px #d1d1d1;
    -webkit-border-top-left-radius: 0px;
    -webkit-border-top-right-radius: 0px;
    -webkit-border-bottom-right-radius: 6px;
    -webkit-border-bottom-left-radius: 6px;
    -moz-border-radius-topleft: 0px;
    -moz-border-radius-topright: 0px;
    -moz-border-radius-bottomright: 6px;
    -moz-border-radius-bottomleft: 6px;
    border-top-left-radius: 0px;
    border-top-right-radius: 0px;
    border-bottom-right-radius: 6px;
    border-bottom-left-radius: 6px;
    overflow: hidden;
}

.textarea {
    padding: 5px;
    height: 80px;
    width: 200px;
    line-height: 18px;
    border: 1px solid #c7c7c7;
    -moz-border-radius: 6px;
    -webkit-border-radius: 6px;
    border-radius: 6px;
    color: #777;
}

.inputtextbox {
    width: 510px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 10px;
    margin: 20px;
    overflow: hidden;
}

    .inputtextbox .inputcontent {
        height: 100px;
    }

.buttons {
    padding: 15px;
    height: 34px;
}

Here are the things you need to configure (if not yet configured):以下是您需要配置的内容(如果尚未配置):

Go to application/config/autoload.php and find this code:转到 application/config/autoload.php 并找到以下代码:

$autoload['helper'] = array('url', 'form','html');// you need to include this so your css may works.

Next, your css,js,images and so on must be outside the application folder ,,,,,it may look like this (the structure):接下来,你的 css,js,images 等必须在应用程序文件夹之外,,,,, 它可能看起来像这样(结构):

-application
  - cache
  -config
  -view
  -model
  -controller
-images
-css
-js
-jquery

In your view :在您看来:

including the css ,js and so on... :包括 css ,js 等等...:

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


<script src="<?php echo base_url(); ?> js/jquery-1.11.0.js"></script>

for the images :对于图像:

<img class="img-responsive" src="<?php echo base_url(); ?>img/good.png" alt="" >

also before I forgot you must also set the base url (application/config/config.php)在我忘记之前,您还必须设置基本 url (application/config/config.php)

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM