title: How to set a:before css style from code behind aspx.cs page
body: <p>I have a property in my aspx.cs page which contains the path of an image. I need to set this path as a background-image on a:before in css like this:</p>
  
  <p>My property name in aspx.cs page is: FirstLinkIcon</p>
  
  <p>now in .aspx page i am trying:</p>
  
  <pre><code>&lt;style&gt;
      .m-quick-links ul li a:before {
          background-image: url('&lt;%=FirstLinkIcon%&gt;');
          background-position: 0 -4164px;
      }
  &lt;/style&gt;
  </code></pre>
  
  <p>But it is throwing error in rendering page due to &lt;%= %> use in css.</p>
  
  <p>I also tried to set this style from code behind like this:</p>
  
  <pre><code>firstLinkUrl.Style.Add("background-image", FirstLinkIcon);
  </code></pre>
  
  <p>but it sets the background-image on anchor tag not for a:before</p>
  
  <p>Please suggest how can i set the a:before style from code behind? or if it can't be done from code behind then how can i access the code behind property in css on aspx page as explained above?</p>
  
  <p>I have searched about it but did not get any help so posting as a question.</p>