title: How to set background-image to ::before selector in code behind C# ASP.NET
body: <p>Currently I was trying to use <a href="/questions/tagged/c%23" class="post-tag" title="show questions tagged &#39;c#&#39;" rel="tag">c#</a>code to set background image to <code>div</code> but it was unsuccessful when I try to put the background image into <code>div</code> and use the <code>div</code> id to set the style to <code>:before</code>.</p>
  
  <p>Here is my code:</p>
  
  <p>CSS code:</p>
  
  <pre><code>#theme1:before {
  
     width: 106px;
     content: " ";
     position: absolute;
     left: -16px;
     top: -6px;
     height: 100px;
  }
  </code></pre>
  
  <p>ASPX code:</p>
  
  <pre><code>&lt;div id="theme1" runat="server"&gt;
       &lt;div id="theme2" runat="server"&gt;
           hello &lt;br/&gt;
       &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>C# code:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      theme1.Style["background-image"] = "Pic/img.jpg";
      theme2.Style["background-image"] = "Pic/img1.png";
  }
  </code></pre>
  
  <p>Any help would be appreciated. Thanks!</p>