Est. 1997 Intermediate

DHTML

Dynamic HTML: the late-1990s browser-vendor name for combining HTML, CSS and client-side script through a document object model, so that a page could change itself after it had loaded.

Created by Microsoft and Netscape (rival vendor implementations), later reconciled by W3C standards

Paradigm Markup/Scripting: declarative HTML and CSS manipulated by event-driven, imperative client-side scripts
Typing Not a language in its own right; scripts inherit the dynamic, weak typing of JavaScript, JScript or VBScript
First Appeared 1997
Latest Version None. DHTML was an umbrella term, never a versioned product or specification

DHTML, short for Dynamic HTML, was the name browser vendors gave in 1997 to a way of building web pages rather than to a programming language in the strict sense. A DHTML page combined HTML markup, Cascading Style Sheets and a client-side scripting language, usually JavaScript or Microsoft’s JScript and VBScript. A document object model joined them together and let the script reach into a page that had already loaded and change its content, style and position, without fetching a new page from the server. In Microsoft’s 1997 words, Dynamic HTML “lets authors control every element of a Web page and change the page’s content and style at any time, even after the page has loaded, without refreshing the page.”

DHTML matters because it was the first time the web page became a programmable surface. Script-driven drop-down menus, animated banners, collapsible outlines, drag-and-drop and early script-only browser games all came out of it. It also produced the worst years of cross-browser incompatibility, and the W3C Document Object Model was created largely to clear up that mess. The techniques survived after the name fell out of use. With asynchronous server calls added, they were renamed Ajax in 2005, and today they are simply how web front ends work.

History & Origins

Before “Dynamic”

By 1996 Netscape Navigator 2 and 3 had JavaScript, but the script could see only a thin “Level 0” view of the page: forms, links, images and anchors. A script could validate a form or swap an image on mouse-over. It could not move a paragraph, restyle a heading or insert new text into a page that had finished rendering. At the same time, style and layout standards were arriving. CSS level 1 became a W3C Recommendation on 17 December 1996. A W3C working draft on positioning HTML elements with CSS followed on 31 January 1997, co-authored by engineers from both Netscape (Scott Furman) and Microsoft (Scott Isaacs).

Netscape had also tried a script-first route to styling. In August 1996 it submitted JavaScript-Based Style Sheets (JSSS) to the W3C, written by Lou Montulli, Brendan Eich, Scott Furman, Donna Converse and Troy Chevalier. In JSSS, styles were JavaScript property assignments such as document.tags.H1.fontSize = "20pt".

Two companies, one name, two models

Microsoft announced Internet Explorer 4.0 on 8 April 1997 and released the Platform Preview for developers the same day. The press release presented support for “Dynamic HTML” as the foundation for “next-generation, interactive Internet content and applications” and called Microsoft’s implementation “an open, language-independent object model” developed in collaboration with the W3C. IE4’s new rendering engine, Trident, reflected every element of the page into script through the document.all collection. Any CSS property could be changed from script, and the page reflowed on the spot. IE4 shipped on 22 September 1997.

Netscape shipped Communicator 4.0 (Navigator 4) in June 1997 with its own “Dynamic HTML in Netscape Communicator”. Its model centred on layers: a proprietary <LAYER> element (or any absolutely positioned element) that became a separate document object, reachable through document.layers. A layer could be moved, clipped, shown, hidden or rewritten with layer.document.write(), but ordinary elements inside the page could not be restyled after load. Navigator 4 also implemented JSSS, and according to Håkon Wium Lie and Bert Bos it implemented CSS internally by translating rules into JavaScript.

Both companies used the same marketing term for two incompatible object models. A W3C FAQ later defined DHTML as “a term used by some vendors to describe the combination of HTML, style sheets and scripts that allows documents to be animated”, which is a careful description of a term the W3C itself never standardised.

Standards catch up

The W3C answered with a run of Recommendations. HTML 4.0 (18 December 1997) standardised the intrinsic event attributes. CSS2 (12 May 1998) absorbed positioning and z-ordering. DOM Level 1 (1 October 1998) defined a single, platform- and language-neutral object model for HTML and XML documents. The DOM FAQ says plainly that “compatibility with DHTML was a motivating factor in the development of the DOM.” The browser-specific models of the version-4 era became known as the “intermediate DOMs”.

Microsoft kept extending its own DHTML in the meantime. Internet Explorer 5 (18 March 1999) added DHTML behaviors: script components in .htc files, attached to elements through a CSS behavior property and submitted to the W3C as the HTML Components Note in October 1998. It also added HTML Applications, which run DHTML pages as trusted desktop programs, and the XMLHTTP object.

Design Philosophy

DHTML had no designer and no specification. What held it together was an idea shared by the vendors:

  • The page is a live object tree. Once HTML is parsed, it stops being text and becomes objects that a script can read and change.
  • Separation of concerns, mostly. HTML holds the structure, CSS the presentation and script the behaviour. In practice the 1997 to 2000 code mixed all three freely, with inline onmouseover handlers and style properties set from script.
  • Client-side only. In the DHTML model all the work happens in the browser after the page loads. To get new data from the server, the page normally had to be reloaded or submitted. That limit is exactly what Ajax later removed.
  • Language independence, in theory. Microsoft described its object model as language-independent, and IE4 could script it equally from JScript or VBScript. In practice JavaScript and JScript dominated because Netscape supported only JavaScript.

Key Features

CapabilityInternet Explorer 4+Netscape Navigator 4W3C standard equivalent
Reach any elementdocument.all["id"]Only layers and positioned elements, via document.layers["id"]document.getElementById("id") (DOM Level 1)
Move an elementel.style.pixelLeft = x or el.style.leftlayer.left = x or layer.moveTo(x, y)el.style.left = x + "px"
Show or hideel.style.visibility = "hidden"layer.visibility = "hide"el.style.visibility = "hidden"
Replace contentel.innerHTML, el.innerTextlayer.document.write() then close()DOM node methods (innerHTML was later standardised in HTML5)
Event handlingEvent bubbling, global window.eventEvent capturing (captureEvents)DOM Level 2 Events (2000)
Visual effectsCSS filter (alpha, blur, shadow) and page transitions—CSS3 opacity, transforms, transitions

The classic cross-browser idiom

Supporting both object models meant branching on whichever collection existed, a practice later called object detection:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// Move an element 10 pixels to the right, c. 1998-2001
function nudge(id) {
  if (document.getElementById) {            // W3C DOM (IE5+, Netscape 6+)
    var el = document.getElementById(id);
    el.style.left = (parseInt(el.style.left, 10) + 10) + "px";
  } else if (document.all) {                // Internet Explorer 4
    document.all[id].style.pixelLeft += 10;
  } else if (document.layers) {             // Netscape Navigator 4
    document.layers[id].left += 10;
  }
}

Libraries of DHTML menus, tickers and drag-and-drop scripts were often built from many branches like this one.

Microsoft-specific DHTML

1
2
3
<!-- IE4+ only: a visual filter and an .htc behavior (IE5+) -->
<img src="logo.gif" style="filter: alpha(opacity=50)">
<li style="behavior: url(hilite.htc)">Hover me</li>

Filters and transitions were rendered through DirectX. In 2012 Microsoft’s IE team wrote of their “inferior performance compared to their standards-based replacements”, though the post publishes no benchmark figures. Microsoft’s documentation declares binary behaviors obsolete as of Internet Explorer 10.

Evolution

  1. 1997–1998: the rival models. IE4 against Navigator 4, and two code paths for every effect.
  2. 1998–2001: standardisation. DOM Level 1, CSS2 and DOM Level 2 give a common target. IE5, IE6 and Netscape 6, which was rebuilt on Gecko and dropped <LAYER> and document.layers, converge on getElementById.
  3. 2001–2005: “DOM scripting”. Developers of the web-standards movement moved away from the term “DHTML”, which by then was associated with browser sniffing and brittle effects, and towards unobtrusive, standards-based scripting.
  4. 2005 onwards: Ajax and libraries. Garrett’s “Ajax” essay (18 February 2005) lists the DOM “for dynamic display of and interaction with data” as one of its building blocks, next to XMLHttpRequest. JavaScript libraries such as jQuery then hid the remaining browser differences.
  5. 2012: the last proprietary pieces go. IE10 removes legacy DX filters for Internet sites, and the remaining IE-only DHTML extensions fade along with Internet Explorer.

Current Relevance

The term “DHTML” is historical. Nobody describes a new site as DHTML today, and the proprietary pieces, document.layers, <LAYER>, JSSS, DX filters and .htc behaviors, run only in archived or emulated browsers. The idea itself won completely. Every modern web framework is, at bottom, script that changes a live DOM tree through CSS and markup after page load, which is the model DHTML introduced. Some DHTML-era Microsoft APIs survived by becoming standards. innerHTML, first exposed by IE4, is now specified in the HTML Living Standard. XMLHTTP, written for a DHTML webmail client, became XMLHttpRequest.

Why It Matters

  • It turned documents into applications. DHTML was among the first widely deployed demonstrations that a web page could behave like a program interface.
  • It forced the DOM into existence. The pain of two incompatible “Dynamic HTML” models was a direct motivation for the W3C DOM, the API every browser still implements.
  • It was the testbed for the browser wars. DHTML is where Microsoft and Netscape competed hardest for developers. The habits it produced, such as browser sniffing, “best viewed in” badges and forked code paths, shaped the web-standards movement that reacted against them.
  • It led directly to Ajax. XMLHttpRequest was built to serve a DHTML interface, and Ajax is DHTML with a background channel to the server.

Timeline

1996
Netscape submits JavaScript-Based Style Sheets (JSSS) to the W3C. Lou Montulli, Brendan Eich, Scott Furman, Donna Converse and Troy Chevalier are the authors, and the proposal is dated August 1996. Script-driven styling of this kind became one strand of Netscape's DHTML. In December the W3C publishes CSS level 1 as a Recommendation (17 December 1996)
1997
The W3C publishes the working draft 'Positioning HTML Elements with Cascading Style Sheets' (31 January 1997). Its authors include Scott Furman of Netscape and Scott Isaacs of Microsoft. This absolute and relative positioning model is what made DHTML animation and layering possible
1997
On 8 April 1997 Microsoft announces Internet Explorer 4.0 and releases its Platform Preview, promoting 'Dynamic HTML' as the foundation for next-generation interactive content. Netscape Communicator 4.0 ships in June with its own, incompatible DHTML model, built on the proprietary LAYER element and JSSS
1997
Internet Explorer 4.0 is released on 22 September 1997. Its Trident engine exposes every element of the page to script, along with visual filters and transitions. A week earlier, Microsoft announced scriptlets, which are web pages reusable as DHTML components
1997
HTML 4.0 becomes a W3C Recommendation on 18 December 1997, standardising the intrinsic event attributes (onclick, onmouseover and so on) that DHTML scripts relied on
1998
CSS2 (12 May 1998) folds CSS positioning into a full Recommendation. On 1 October 1998 DOM Level 1 becomes a W3C Recommendation, giving the browsers a common, vendor-neutral object model that replaced the rival 'intermediate DOMs' of version 4. Microsoft submits HTML Components (DHTML behaviors) to the W3C as a Note on 23 October
1999
Internet Explorer 5 is released on 18 March 1999 with DHTML behaviors (.htc files), HTML Applications (HTA) and the XMLHTTP ActiveX object. XMLHTTP was written for the DHTML version of Outlook Web Access and is the ancestor of XMLHttpRequest
2000
Netscape 6, released in November 2000 on the Mozilla Gecko engine, drops the Netscape 4 LAYER element, the document.layers collection and JSSS in favour of the W3C DOM, ending the two-model era of DHTML
2005
Jesse James Garrett coins 'Ajax' on 18 February 2005. It names DHTML-style DOM manipulation plus asynchronous XMLHttpRequest calls, and the new term largely replaces 'DHTML' in developer vocabulary
2012
On 4 June 2012 Microsoft announces that Internet Explorer 10 removes the legacy visual filters and transitions, 'first introduced in IE4', from all document modes for Internet-zone sites, citing their performance and 'very low usage on the public Web'. They were arguably among the last Microsoft-specific DHTML features still in a shipping browser

Notable Uses & Legacy

Internet Explorer 4 Active Channels and Active Desktop

Microsoft's push-content Channels, introduced with Internet Explorer 4 in 1997, were promoted as a showcase for the browser's new features, Dynamic HTML among them; how heavily individual channels used DHTML varied. With the optional Windows Desktop Update, the same browser engine rendered web content directly onto the Windows desktop.

Outlook Web Access (Exchange 2000)

The Exchange 2000 team built a rich DHTML interface for Outlook Web Access, starting around late 1998. Alex Hopmann has written that he wrote the XMLHTTP component so this DHTML client could exchange data with the server without full form posts, and that it shipped in Internet Explorer 5 as part of the MSXML library.

1997 web authoring tools

Microsoft's 24 June 1997 announcement listed tools already demonstrating Dynamic HTML support: SoftQuad HoTMetaL Pro 4.0, Pictorius iNet Developer 2.0, ExperTelligence WebberActive 1.1 and Bluestone Sapphire/Web 4.0. Allaire, Borland, Macromedia, Sybase's Powersoft division and Microsoft's own FrontPage and Visual InterDev teams announced future support.

HTML Applications (HTA)

From Internet Explorer 5 onwards, Windows could run a DHTML page as a fully trusted desktop program through mshta.exe. Administrators and tool authors commonly used HTAs to build quick graphical front ends from HTML, CSS and VBScript or JScript.

Language Influence

Influenced By

HTML CSS JavaScript JScript VBScript JavaScript Style Sheets (JSSS)

Influenced

Ajax HTA (HTML Application) W3C DOM

Running Today

Run examples using the official Docker image:

docker pull
Last updated: