I have completely stripped all my views/blocks down so they only produce exactly what I put into them..but I created a view and rewrote the fields and this part of my code will not print exactly as it is here:

<div style="background-image: url('sites/all/themes/my-theme/images/my-image.jpg');" class="slides-fullscreen-img"></div>

Instead, when the block is rendered I get:

<div class="slides-fullscreen-img"></div>

So it strips away come of my code. Does anyone know how I can get round this problem?

  • Have you tried PHP code?
    – Inizio
    May 26, 2014 at 13:45

1 Answer 1


Adding a class and then the style to your stylesheet is the normal practise. Quick fix

.slides-full-screen-image { Background-image: url....


If you have more calls to that class where you don't want the image then you should add an additional class name.

  • Thanks but that means I cannot use the backend of Drupal to upload images, as the file names needs to be in the CSS. In this case it's a parallax website. May 26, 2014 at 7:28
  • Does that mean you set up an empty class for .slides-full-screen-image and edit in firebug ; you can't get the image to display even if you use the full image url ? Inc Http://wwww.you website etc
    – Deejay
    May 26, 2014 at 7:34

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.