0

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?

2
  • Solve what problem? Please provide some details about exactly what is "not working". Do you have any error messages (including in your browser's developer console)? Commented Feb 21, 2014 at 4:34
  • where does the css file reside? Commented Feb 21, 2014 at 5:03

1 Answer 1

1

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);
Sign up to request clarification or add additional context in comments.

4 Comments

Downvoter care to comment? This looks about right to me
i always use code like that in css file but background is not display
did you check path of file?
if my solution is helpful, then accept it. It will helpful others too to find better solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.