Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1082583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:19:12+00:00 2026-05-16T22:19:12+00:00

Is there a .Net CSS parser that will allow me to parse css shorthand

  • 0

Is there a .Net CSS parser that will allow me to parse css shorthand properties into their longhand form?

For example I’d like to take the following:

        #somediv{
            margin: 10px;
            padding: 10px 20px;
            border:5px solid #FFF;
        }

And translate it to:

        #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; 
        }

Here is a pretty good list of all the different properties I’d need to handle in this manner: http://www.dustindiaz.com/css-shorthand/

Ideally I’d like something in .Net but if there’s something in another language that’s open source I can probably adapt it.

Update

Without getting into too much detail as to exactly what I’m trying to do here is the basic premise:

I need to programmaticly take multiple CSS docs and merge them to create one definitive set of CSS.

So if doc 1 has :

p { padding: 10px;}

And then I add on doc 2:

p { padding-left:20px;}

The resulting CSS should be:

p { padding-top: 10px; padding-right:10px; padding-bottom:10px; padding-left:20px;}

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:19:13+00:00Added an answer on May 16, 2026 at 10:19 pm

    For regular CSS parsing I’ve found this to be the easiest to use:

    http://www.codeproject.com/KB/recipes/CSSParser.aspx

    For breaking down the shorthand properties into their longhand form I’ve found two that can do it:

    In .Net : http://www.modeltext.com/css/index.aspx

    In JavaScript: http://www.glazman.org/JSCSSP/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a dynamic CSS file in ASP.NET MVC2, and I'm now encountering
here is the page where i need to add CSS: http://upload.wikimedia.org/wikipedia/commons/a/a5/Map_of_USA_with_state_names.svg since there is
There are customers that want to customize to brand my product, while have me
The problem: I am embedding a CSS file into a custom control library with
I have an ASP.NET web application and I'm thinking about the following: before sending
I am working on a big .NET project. I am currently creating an automated
I want to make a ringtones site with the functionalities of zedge.net, I think
I'm working on an ASP.NET Web Project with some AJAX magic. As my GridView
I'm using Ajax to dynamically populate a DIV. I have each page content stored

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.