O'Reilly logo

Inside JavaScript by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 21. Cascading Style Sheets and CGI Programming

Cascading Style Sheets and CGI Programming

In this chapter, I’ll take a look at working with Cascading Style Sheets (CSS). CSS and JavaScript connect well because styles are dynamic these days, which means you can change them on-the-fly, as we’ll see in this chapter.

You set styles using style attributes—for example, here’s how I use the color style attribute to set the text color in a document to coral:

<BODY STYLE="color: coral"> 
        . 
        . 
        . 
</BODY> 

The exciting thing is that you can access style properties from JavaScript. We’ve already seen this at work to some extent. For example, here’s Listing 16-01.html, which turns the color of text ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required