我有字符串的CSS屬性和值:正則表達式與CSS屬性
str = "filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#000000');
background: -webkit-linear-gradient(top, black, white);
animation-duration: 12s;";
,我想我的比賽只返回特性
properties = text.match(/[^;:]*:/g);
,但它也返回「進程id」,我怎樣才能避免它?
你在做什麼?根據不同,使用CSS解析器或僅查詢元素集樣式屬性可能會更好。 – Esailija 2012-04-14 15:17:33