title: Is it possible to add a background image to a <div> element on a JSP page? - Spring
body: <p>I have been looking for an answer for this for a few days now and can not seem to find a solution. Below is the example I am trying to implement, however no image is displayed. The aim is to have a responsive image that covers the entire page.</p>
  
  <pre><code>&lt;div class="col-md-12 img-responsive" 
  style="background-image:url(&lt;c:url value='/resources/img/abstract-ice.jpeg' /&gt;);"&gt;
  </code></pre>
  
  <p>as far as I am aware this should work, I have resource mapping implemented and is working, I can tell this by navigating to the url and the image is displayed.</p>
  
  <p>When placing this tag into the body element with the <code>background</code> attribute it displays the image but is not responsive and cuts the image as it pleases. I have tried styling this with bootstrap and using my own css, but anything I do makes no change/removes the image completely.</p>
  
  <p>This url does also work with the <code>&lt;img&gt;</code> tag except then I can not overlay other elements with ease. </p>
  
  <p>Ultimately my question is how can I get the div element to accept this url as a background image using pure css?</p>
  
  <p>Any suggestions/prior experience would be welcomed. </p>
  
  <p><strong>HTML code</strong></p>
  
  <pre><code>&lt;body background=""&gt;
  &lt;div class="container-fluid"&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-md-12 header_bar"&gt;
              &lt;div class="col-md-6 text-left"&gt;
                  &lt;a href="#" class="nav_login"&gt;Home&lt;/a&gt;
              &lt;/div&gt;
              &lt;div class="col-md-6 text-right"&gt;
                  &lt;a href="#" class="nav_login"&gt;log in&lt;/a&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="container-fluid"&gt;                                           
      &lt;div class="row"&gt;
          &lt;div class="col-md-12 img-responsive" style="background-image:url(&lt;c:url value='/resources/img/abstract-ice.jpeg' /&gt;);"&gt;
          &lt;/div&gt;                                          
  
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>