Chapter 40. Positioned Objects


  • Layer concepts

  • Moving, hiding, and showing content

  • Layering objects in the modern DOM

This chapter tackles positioned objects and layers, briefly acknowledging the early contribution that Netscape Navigator 4 made to the subject. Having survived a turbulent time of severe browser compatibility problems in this area, modern browsers have now adopted W3C standards for positioned content. Since current browsers explicitly do not provide backward compatibility with the original NN4 scripted layer element object, this chapter won't do so either.

The modern solution to scripted layering is through Cascading Style Sheets (CSS) and the scripting thereof. This chapter therefore focuses on how to apply CSS and modern DOM techniques to manage positioned elements in modern browsers.

What Is a Layer?

Terminology in the area of positioned elements has become a bit confusing over time. Because NN4 was the earliest browser to be released with positioned elements (the layer element), the term layer became synonymous with any positioned element. When IE4 came on the scene, it was convenient to call a stylesheet-positioned element (in other words, an element governed by a stylesheet rule with the position attribute) a layer as a generic term for any positioned element. In fact, NN4 even treated an element that was positioned through stylesheets as if it were a genuine layer object (although with some minor differences).

In the end, the layer term made good sense ...

Get JavaScript® Bible, Sixth Edition 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.