Cédric Boivin
Cédric Boivin

Reputation: 11361

Format and Validate CSS with jquery

It's there a jquery plugin to validate CSS ?

I mean, i yould like to let the user enter is own CSS in a textbox and validate if is a valid CSS with jquery ?

example :

@font-face {
    font-family: 'NationalRegular';
    src: url('http://localced.com/national-regular-webfont.eot');
    src: local('National'), local('NationalRegular'), url('http://localced.com/national-regular-webfont.woff') format('woff'), url('http://localced.com/national-regular-webfont.ttf') format('truetype'), url('http://localced.com/national-regular-webfont.svg#webfontHGfqMJAZ') format('svg');
    font-weight: normal;
    font-style: normal;
***notgoodCSS***:this is not good;
}

Upvotes: 1

Views: 407

Answers (2)

Christophe Eblé
Christophe Eblé

Reputation: 8161

Use the W3C validator on your own server.

Execute the commandline and return the result to jquery (through an Ajax call).

http://jigsaw.w3.org/css-validator/DOWNLOAD.html

Upvotes: 1

Elliott Bowles
Elliott Bowles

Reputation: 398

I'm not sure about Jquery, but do you know about the W3C CSS Validation Service? You can enter a url to a css file and it will validate it as valid or invalid and tell you how to correct it.

Upvotes: 0

Related Questions