CSS Basics

As mentioned in the opening of the chapter, DHTML is a combination of JavaScript, HTML, and CSS. CSS enables you to position HTML precisely on your pages—no longer will you have to use bizarre tables and invisible GIFs to position elements. With a CSS you can easily place a GIF precisely in the center of your page, or position a block of text in the lower-right corner.

The <div> Tag

Before you can position any HTML, you have to use the <div> and </div> tags to tell your browser which displayed HTML you want to position. Figure 13-2 shows a simple use of <div> tags.

Basic div usage

Figure 13-2. Basic div usage

The page displayed by this code (Figure 13-3 ...

Get The Book of JavaScript, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.