Gecko's "Almost Standards" Mode

As of Mozilla 1.0.1 and 1.1 beta, there is a new rendering mode referred to as "almost standards" mode. This is added to the long-standing "quirks" and "standards" modes.

"Almost standards" rendering mode is exactly the same as "standards" mode in all details save one, where it works like "quirks" mode: the height calculations for line boxes and some of the inline elements in them.  A common case that this affects is the layout of images inside table cells. This means that sliced-images-in-tables layouts are less likely to fall apart in Gecko-based browsers based on the rendering engine found in Mozilla 1.0.1 or later when in either "quirks" or "almost standards" mode. (See the DevEdge article "Images, Tables, and Mysterious Gaps" for a detailed explanation of how such layouts are treated in "standards" mode.)

In slightly more detail, what differs in almost-standards mode is roughly this: inline boxes that have no non-whitespace text as a child and have no border, padding, or margin:

  • do not influence the size of the line box (that is, their line-height is ignored)
  • do not get a height (e.g., for their background) larger than that of their descendants, even if their font size is larger (if they have no descendents, they are zero-height positioned at their baseline)

Other than this one difference, "almost standards" and "standards" modes are exactly the same in terms of layout and other behaviors.

Triggering "Almost Standards"

The DOCTYPEs that will trigger "almost standards" mode are those which contain:

  • The public identifier "-//W3C//DTD XHTML 1.0 Transitional//EN"
  • The public identifier "-//W3C//DTD XHTML 1.0 Frameset//EN"
  • The public identifier "-//W3C//DTD HTML 4.01 Transitional//EN", with a system identifier
  • The public identifier "-//W3C//DTD HTML 4.01 Frameset//EN", with a system identifier
  • The IBM system DOCTYPE "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"

A complete DOCTYPE contains a public identifier and a system identifier. In discussions of DOCTYPEs, many people will refer to a DOCTYPE as being "with URI" or "without URI." The URI is the system identifier. For example, consider the following DOCTYPE:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
			"http://www.w3.org/TR/html4/loose.dtd">

The parts are as follows:

  • Public Identifier: "-//W3C//DTD HTML 4.01 Transitional//EN"
  • System Identifier: "http://www.w3.org/TR/html4/loose.dtd"

Thus any HTML 4.01 Transitional or Frameset DOCTYPE with a URI (system identifier) will trigger "almost standards" mode, as will any XHTML 1.0 Transitional or Frameset DOCTYPE, with or without the URI. Authors outside of IBM do not need to worry about the custom DOCTYPE that will also trigger "almost standards" mode.

Recommendations

  • For authors who are attempting to migrate to validated markup using either HTML 4.01 or XHTML 1.0, and who are still using image-in-table design concepts, make sure to use a DOCTYPE that will trigger "almost standards" mode.

Also On MDC

Original Document Information

  • Author(s): Eric A. Meyer, Netscape Communications
  • Last Updated Date: Published 08 Nov 2002
  • Copyright Information: Copyright © 2001-2003 Netscape. All rights reserved.
  • Note: This reprinted article was originally part of the DevEdge site.

 

Document Tags and Contributors

Last updated by: openjck,