css揭秘--笔记(未完)
第0章 关于本书 1, 本书要用到一个工具函数————$$(),它可以让我们更容易获取和遍历所有匹配特定css选择符的dom元素: 1 function $$(selector,context){ 2 context=context|| document; 3 var elements= context.querySelectorAll(selector); 4 return Array.prototype.slice.call(elements); 5 } 2, 以下实现一个效果: 1 linear-gradient(#fff, #000); 2 linear-gradient(to bottom, #fff, #000); 3 linear-gradient(to top, #000, #fff); 4 linear-gradient(180deg, #fff, #000); 5 linear-gradient(to bottom, #fff 0%, #000 100%); 3, 检查属性是否存在: 1 var root= document.documentElement; 2 if ('textShadow' in root.style){ 3 root.classList.add('textShadow' ); 4 } else { 5 root.classList.add