Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
to use a CSS expression to make up for some of the missing functionality in these older browsers, resist the urge and save yourself a lot of time and effort. Keep JavaScript out of your CSS. Keep CSS Out of JavaScript Keeping this clean separation between CSS and JavaScript can be challenging at times. These two languages work quite well together, so it is tempting to manipulate style data within JavaScript. The most popular way to script style changes is through the use of the style property on any DOM element. The style property is an object containing properties that allow you to read and change CSS properties. For instance, you can change the text color of an element to red like this: // Bad element.style.color = "red"; It's actually quite common to see large blocks of code using style to change multiple properties, such as: // Bad element.style.color = "red"; element.style.left = "10px"; element.style.top = "100px"; element.style.visibility = "visible"; This approach is problematic, because the style information is now located inside of