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 ...

Get Inside JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.