title: How to apply background image to a xhtml file?
body: <p>I am working with javaee jsf pages. I have a page called main.xhtml. Here it is:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"  &gt;
  &lt;h:head&gt;
      &lt;title&gt;Facelet Title&lt;/title&gt;
  &lt;/h:head&gt;
  &lt;h:body&gt;
  
          &lt;a href="editinfo.xhtml"&gt;Edit Account&lt;/a&gt;
          &lt;a href="createaccount.xhtml"&gt;Create new account&lt;/a&gt;
  
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am trying to add a background image to the page. To do this i first tried in the body part:</p>
  
  <pre><code> &lt;h:body background-img="../images/background.jpg" &gt;
  </code></pre>
  
  <p>but it does not work, there is no such attribure called background-img. Then i created a css file called styles.css.</p>
  
  <pre><code>.main
  {
      background-image: url('../images/background.jpg');
  }
  </code></pre>
  
  <p>And edited the main.xhtml:</p>
  
  <pre><code>&lt;h:body style="../src/java/css/styles.css" &gt;
  </code></pre>
  
  <p>But this body declaration still gives an error saying that unexpected characters '.''.' found. I put those dots to go one folder up. Am i doing wrong? How can apply this image to the background of my page?</p>
  
  <p>Thanks</p>