CHAPTER 16 Scripting CSS
CSS is a complex standard that, at the time of this writing, is undergoing active development. CSS is a book-length topic of its own and complete coverage is well beyond the scope of this book.1 In order to understand CSS scripting, however, it is necessary to be familiar with CSS basics and with the most commonly scripted styles, so this chapter begins with a concise overview of CSS, followed by an explanation of key styles that are most amenable to scripting. After these two introductory sections, the chapter moves on to explain how to script CSS. §16.3 explains the most common and important technique: altering the styles that apply to individual document elements using the HTML style attribute. Although an element’s style attribute can be used to set styles, it is not useful for querying an element’s style. §16.4 explains how to query the computed style of any element. §16.5 explains how to alter many styles at once by altering the style attribute of an element. It is also possible, though less common, to script stylesheets directly, and §16.6 shows how to enable and disable stylesheets, alter the rules of existing stylesheets, and add new stylesheets.
1. But see CSS: The Definitive Guide by Eric Meyer (O’Reilly), for example.欢迎转载,转载请注明来自一手册:http://yishouce.com/book/1/27725.html