codecamp

hack使用规范

hack使用规范

重要原则:尽量少用hack,能不hack坚决不hack,不允许滥用hack。

如果需要使用hack,请参考以下hack方式:

区分规则

IE6 * html selector { … }
IE7 *+html selector { … }
非IE6 html>body selector { … }
firefox @-moz-document url-prefix() { … }
safari3+/chrome @media screen and (-webkit-min-device-pixel-ratio:0) { … }
opera @media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0) { … }
iPhone/mobile webkit @media screen and (max-device-width: 480px) { … }


区分属性

IE6 _property: value
IE7 +property: value
IE6/7 *property: value
IE6/7/8/9 property: value\9


CSS属性取值规范
z-index取值规范
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }