insert an image in yii views with the main.css

0

I want to insert an image using the main.css of yii but when using this code:

.configuracion {
    background-image: url(configuration_13194.png) no-repeat;
    background-color: red;
}

And then use it in

echo "<div class='configuracion'> a </div>";

You just do not see it but the red line of the background comes out. I also do not know where I should place the image so that the main.css recognizes the address.

    
asked by Joel 08.06.2018 в 15:05
source

1 answer

0

With the following you can insert a background image in the div with class configuration.

This image is located in the images folder inside the web folder. Basically what makes the url code is to return a directory back to where the main.css is located (it would be the web folder) enter the images folder and select the desired image ...

.configuracion {
    background: url(../imagenes/configuration_13194.png.JPG) no-repeat center center; 
}

The above should work for you. You can also try other options:

.configuracion {
  height: 400px;
  width: 100%;
  background: url(../imagenes/configuration_13194.png.JPG) no-repeat center center; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}
    
answered by 13.06.2018 в 22:16