简体   繁体   中英

how to make background css URL in codeigniter?

I'm trying to display some images using the background url in CSS but is not working. I put this code in one of my CSS selector

        background:url(../assets/images/teksture2.png);

and view code

        <!doctype html>
    <html lang="en">
    <head>
        <meta content-type: "text/css" charset="UTF-8">
        <title>Aplikasi Inventori Barang</title>
        <link rel="stylesheet" href="<?php echo base_url("assets/css/layout.css");?>">

    </head>
    <body>
        <div id="header">
            <div class="image"><img src="<?php echo base_url("assets/images/logo.png");?>" alt="logo"></div>
        </div>
    </body>
    </html>

and in controller file is

    <?php

    /**
    * 
    */
    class Home extends CI_Controller
    {

        function __construct()
        {
            parent::__construct();
        }

        function index()
        {
            $this->load->helper('url');
            $this->load->view('index');
        }
    }

?>

can you help me solve this problem?

Hope css and images folders exist inside the asset folder. Then in your css file, you have to use below code.

 background:url(../images/teksture2.png);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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