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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:58 次

字数:4970

最后编辑:6 年前

编辑次数:0 次

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文