title: How can I expand CSS shorthand properties programmatically?
body: <p>Is there a .Net CSS parser that will allow me to parse <a href="http://www.w3.org/TR/CSS21/about.html#shorthand" rel="nofollow noreferrer">css shorthand properties</a> into their longhand form?</p>
  
  <p>For example I'd like to take the following:</p>
  
  <pre><code>        #somediv{
              margin: 10px;
              padding: 10px 20px;
              border:5px solid #FFF;
          }
  </code></pre>
  
  <p>And translate it to:</p>
  
  <pre><code>        #somediv{
              margin-top: 10px;
              margin-right: 10px;
              margin-bottom: 10px;
              margin-left: 10px;
              padding-top: 10px;
              padding-right: 20px;
              padding-bottom: 10px;
              padding-left: 20px;
              border-width: 5px;
              border-style: solid;
              border-color: #FFF; 
          }
  </code></pre>
  
  <p>Here is a pretty good list of all the different properties I'd need to handle in this manner:  <a href="http://www.dustindiaz.com/css-shorthand/" rel="nofollow noreferrer">http://www.dustindiaz.com/css-shorthand/</a></p>
  
  <p>Ideally I'd like something in .Net but if there's something in another language that's open source I can probably adapt it.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Without getting into too much detail as to exactly what I'm trying to do here is the basic premise:</p>
  
  <p>I need to programmaticly take multiple CSS docs and merge them to create one definitive set of CSS.</p>
  
  <p>So if doc 1 has :</p>
  
  <pre><code>p { padding: 10px;}
  </code></pre>
  
  <p>And then I add on doc 2:</p>
  
  <pre><code>p { padding-left:20px;}
  </code></pre>
  
  <p>The resulting CSS should be:</p>
  
  <pre><code>p { padding-top: 10px; padding-right:10px; padding-bottom:10px; padding-left:20px;}
  </code></pre>
  
  <p>Because the later added doc overwrites the single property.  To do this accurately I would need to take every CSS and break down every property to it's lowest element first.     </p>