2010-12-13 57 views
1

这里有一个jQuery插件来验证CSS?使用jquery格式化和验证CSS

我的意思是,我喜欢让用户输入自己的CSS在文本框中,并验证是否是有效的CSS与jQuery?

例如:

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

回答

1

在您自己的服务器上使用W3C验证程序。

执行命令行并将结果返回给jquery(通过Ajax调用)。

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

+1

然后你就可以用自己的SOAP API:http://jigsaw.w3.org/css-validator/api.html – 2010-12-13 22:15:58

0

我不知道关于jQuery的,但是你知道有关W3C CSS Validation Service?你可以输入一个URL到一个CSS文件,它会验证它是有效还是无效,并告诉你如何纠正它。