I am working with codeigniter,i am working in home.php file(in view folder),I have images folder in root (inside assets folder),but image is not displaying in front end,
I am tried with following code but not working,where i am wrong ?
<section id="landing" class="bg-cover centered-area clr-white" style="background-image: url('../../assets/images/bg1.jpg')">
I think you can use base_url()
if you are using CI framework like:
<section id="landing" class="bg-cover centered-area clr-white" style="background-image: url('<?=base_url()?>assets/images/bg1.jpg')">
Or, simple, pass your path in base_url()
method like:
echo base_url("assets/images/bg1.jpg");
The above example would return something like:
http://yoursite.com/assets/images/bg1.jpg
Important: but make sure you have included url
helper either in your controller class or in autoload.php
Rather than code like this url('../../assets/images/bg1.jpg'
it better to use base_url()
<img src="<?php echo base_url('images/bg1.jpg'); ?>" />