//檢測瀏覽器對CSS屬性的支持 supports = (function() { var div = document.createElement('div'), vendors = 'Khtml Ms O Moz Webkit'.split(' '); return function(prop) { if ( prop in div.style ) return true; var len = vendors.length; prop = prop.replace(/^[a-z]/, function(val) { return val.toUpperCase(); }); while(len--) { if ( vendors[len] + prop in div.style ) { // browser supports box-shadow. Do what you need. // Or use a bang (!) to test if the browser doesn't. return true; } } return false; }; })(); supports('background');//true
chrome console:css
-
Javascript檢測瀏覽器對CSS屬性的支持,html
瀏覽器CSS屬性支持檢測,探測,測試。js檢測是否支持css屬性。
-chrome