HTML and CSS Reference
hiding and displaying the nested list
5. Save your changes to the file, and then reload usconst.htm in your Web browser.
Verify that as you click the plus/minus boxes in the table of contents, the nested lists
within the table of contents are alternately hidden and redisplayed. Figure 14-51
shows the table of contents with a mixture of hidden and displayed nested lists.
collapsing the table of contents
Expanding and Collapsing the Source Document
The final step of the dynamic table of contents is to enable the user to expand and
collapse the document itself so that it mimics the actions of the table of contents. One
problem is that the structure of the table of contents is markedly different from that of
the source document. In the table of contents, different sections are nested within one
another. By contrast, all sections are siblings in the source document, with only the
headings indicating where a section begins and ends, and the element names indicating
what level each section represents. See Figure 14-52.