user3480644 user3480644 - 25 days ago 11
MySQL Question

How to set image URL in Stylesheet

I am using codeigniter to build an application. I have placed my images in

assets/images/images/myimage.jpg
I know how to call this from PHP file. I write..

<?php echo base_url(); ?>assets/images/images/myimage.jpg


but I'm unable to understand how to do this in a stylesheet, I tried to write the following but its not getting the image

background:url(../assets/images/images/header-bg.jpg) no-repeat center top;


The
Asset
folder is in the base directory along with
application,system and user_guide
folder.

Answer

One Sample Example ; Try like this..

<!DOCTYPE html>
<html>
<head>
<style>
body 
{
background-image:url('image.jpg');
background-color:#cccccc;
}
</style>
</head>

<body>
<h1>Hello World!</h1>
</body>

</html>
Comments