HTML 4.0 Specification

W3C Proposed Recommendation 7-Nov-1997

This version:
Latest version:
Previous version:
Dave Raggett <dsr@w3.org>
Arnaud Le Hors <lehors@w3.org>
Ian Jacobs <ij@w3.org>


This specification defines the HyperText Markup Language (HTML), version 4.0, the publishing language of the World Wide Web. In addition to the text, multimedia, and hyperlink features of the previous versions of HTML, HTML 4.0 supports more multimedia options, scripting languages, style sheets, better printing facilities, and documents that are more accessible to users with disabilities. HTML 4.0 also takes great strides towards the internationalization of documents, with the goal of making the Web truly World Wide.

HTML 4.0 is an SGML application conforming to International Standard ISO 8879 -- Standard Generalized Markup Language [ISO8879]). As an SGML application, the syntax of conforming HTML 4.0 documents is defined by the combination of the SGML declaration and the document type definition (DTD). This specification defines the intended interpretation of HTML 4.0 elements and adds syntax constraints that may not be expressed by the DTD alone.

Status of this document

This is a stable document derived from the 17 September working draft of the HTML 4.0 specification. This document has been produced as part of the W3C HTML Activity. The publication of this document does not imply endorsement by the Consortium's staff or Member organizations.

On 7 November, this document enters a period of review by the Members of the World Wide Web Consortium. Details of this review will be distributed to the representatives of each W3C Member organization.

The review period will end on 5 December. Within 14 days after that date, the document's disposition will be announced: it may become a W3C Recommendation (possibly with minor changes), it may revert to Working Draft status, or it may be dropped as a W3C work item.

Most of this document represents technology tested by multiple implememntations. It includes a small number of features that have not had the benefit of extensive implementation experience. Nonetheless, the experience of the Working Group members with analogous features in other domains has resulted in consensus that these features belong in this specification.

The Working Group expects to resolve minor technical issues during the review phase and communicate its results to the W3C Director.

A list of current W3C Proposed Recommendations and Working Drafts can be found at: http://www.w3.org/TR.

It is proposed that HTML 4.0 be recommended for new documents and applications rather than HTML 3.2, specified in http://www.w3.org/TR/REC-html32.

Available formats

The HTML 4.0 W3C Proposed Recommendation is also available in the following formats:

a plain text file:
http://www.w3.org/TR/PR-html40-971107/html40.txt (691Kb),
HTML as a gzip'ed tar file:
http://www.w3.org/TR/PR-html40-971107/html40.tgz (293Kb),
HTML as a zip file (this is a '.zip' file not an '.exe'):
http://www.w3.org/TR/PR-html40-971107/html40.zip (324Kb),
as well as a postscript file (thanks to html2ps written by Jan Kärrman):
http://www.w3.org/TR/PR-html40-971107/html40.ps (3.5Mb, 339 pages),
and a PDF file:
http://www.w3.org/TR/PR-html40-971107/html40.pdf (2Mb) file.

In case of a discrepancy between electronic and printed forms of the specification, the electronic version is considered the definitive version.

Available languages

The English version of this specification is the only normative version. However, for translations in other languages see http://www.w3.org/TR/PR-html40-971107/translations.html.


Please send detailed comments on this document to www-html-editor@w3.org. We cannot guarantee a personal response but we will try when it is appropriate. Public discussion on HTML features takes place on www-html@w3.org.

Table of Contents

  1. About the HTML 4.0 Specification
    1. How the specification is organized
    2. Document conventions
      1. Elements and attributes
      2. Notes and examples
    3. Acknowledgments
  2. Introduction to HTML 4.0
    1. What is the World Wide Web?
      1. Introduction to URLs
      2. Fragment identifiers
      3. Relative URLs
    2. What is HTML?
      1. A brief history of HTML
    3. HTML 4.0
      1. Internationalization
      2. Accessibility
      3. Tables
      4. Compound documents
      5. Style sheets
      6. Scripting
      7. Printing
    4. Designing documents with HTML 4.0
      1. Separate structure and presentation
      2. Consider universal accessibility to the Web
      3. Help user agents with incremental rendering
  3. On SGML and HTML
    1. Introduction to SGML
    2. SGML constructs used in HTML
      1. Elements
      2. Attributes
      3. Entities
    3. How to read the HTML DTD
      1. DTD Comments
      2. Parameter entity definitions
      3. Element declarations
      4. Attribute definitions
  4. Conformance: requirements and recommendations
    1. Definitions
    2. SGML
    3. The text/html content type
  5. HTML Document Representation - Character sets, character encodings, and entities
    1. The Document Character Set
    2. Character encodings
      1. Choosing an encoding
      2. Specifying the character encoding
    3. Character references
    4. Undisplayable characters
  6. Basic HTML data types - Character data, colors, lengths, URLs, content types, etc.
    1. Case information
    2. SGML basic types
    3. Text strings
    4. URLs
    5. Colors
      1. Notes on using colors
    6. Lengths
    7. Content types (MIME types)
    8. Language codes
    9. Character encodings
    10. Single characters
    11. Dates and times
    12. Link types
    13. Media descriptors
    14. Script data
    15. Frame target names
  7. The global structure of an HTML document - The HEAD and BODY of a document
    1. Introduction to the structure of an HTML document
    2. HTML version information
    3. The HTML element
    4. The document head
      1. HEAD element
      2. The TITLE element
      3. The title attribute
      4. Meta data
    5. The document body
      1. The BODY element
      2. Element identifiers: the id and class attributes
      3. Block-level and inline elements
      4. Grouping elements: the DIV and SPAN elements
      5. Headings: The H1, H2, H3, H4, H5, H6 elements
      6. The ADDRESS element
  8. Language information and text direction - International considerations for text
    1. Specifying the language of content: the lang attribute
      1. Language codes
      2. Inheritance of language codes
      3. Interpretation of language codes
    2. Specifying the direction of text and tables: the dir attribute
      1. Introduction to the bidirectional algorithm
      2. Inheritance of text direction information
      3. Setting the direction of embedded text
      4. Overriding the bidirectional algorithm: the BDO element
      5. Character entities for directionality and joining control
      6. The effect of style sheets on bidirectionality
  9. Text - Paragraphs, Lines, and Phrases
    1. White space
    2. Structured text
      1. Phrase elements: EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, and ABBR
      2. Quotations: The BLOCKQUOTE and Q elements
      3. Subscripts and superscripts: the SUB and SUP elements
    3. Lines and Paragraphs
      1. Paragraphs: the P element
      2. Controlling line breaks
      3. Hyphenation
      4. Preformatted text: The PRE element
      5. Visual rendering of paragraphs
    4. Marking document changes: The INS and DEL elements
  10. Lists - Unordered, Ordered, and Definition Lists
    1. Introduction to lists
    2. Unordered lists (UL), ordered lists (OL), and list items (LI)
    3. Definition lists: the DL, DT, and DD elements
      1. Lists formatted by visual user agents
    4. The DIR and MENU elements
  11. Tables
    1. Introduction to tables
    2. Elements for constructing tables
      1. The TABLE element
      2. Table Captions: The CAPTION element
      3. Row groups: the THEAD, TFOOT, and TBODY elements
      4. Column groups: the COLGROUP and COL elements
      5. Table rows: The TR element
      6. Table cells: The TH and TD elements
    3. Table formatting by visual user agents
      1. Borders and rules
      2. Horizontal and vertical alignment
      3. Cell margins
    4. Table rendering by non-visual user agents
      1. Associating header information with data cells
      2. Categorizing cells
      3. Algorithm to find heading information
    5. Sample table
  12. Links - Hypertext and Media-Independent Links
    1. Introduction to links and anchors
      1. Visiting a linked resource
      2. Other link relationships
      3. Specifying anchors and links
      4. Link titles
      5. Internationalization and links
    2. The A element
      1. Syntax of anchor names
      2. Nested links are illegal
      3. Anchors with the id attribute
      4. Unavailable and unidentifiable resources
    3. Document relationships: the LINK element
      1. Forward and reverse links
      2. Links and external style sheets
      3. Links and search engines
    4. Path information: the BASE element
      1. Resolving relative URLs
  13. Objects, Images, and Applets
    1. Introduction to objects, images, and applets
    2. Including an image: the IMG element
    3. Generic inclusion: the OBJECT element
      1. Rules for rendering objects
      2. Object initialization: the PARAM element
      3. Global naming schemes for objects
      4. Object declarations and instantiations
    4. Including an applet: the APPLET element
    5. Including HTML in another HTML document
    6. Image maps
      1. Client-side image maps
      2. Server-side image maps
    7. Visual presentation of images, objects, and applets
      1. Width and height
      2. White space around images and objects
      3. Borders
      4. Alignment
    8. How to specify alternate text
  14. Style Sheets - Controlling the presentation of an HTML document
    1. Introduction to style sheets
    2. Adding style to HTML
      1. Setting the default style sheet language
      2. Inline style information
      3. Header style information: the STYLE element
      4. Media types
      5. External style sheets
      6. Setting the default named style
      7. Media-dependent cascades
    3. Inheritance and cascading
    4. Hiding the content of style elements from non-conforming user agents
    5. Specifying style through HTTP headers
  15. Alignment, font styles, and horizontal rules
    1. Formatting
      1. Background color
      2. Alignment
      3. Floating objects
    2. Fonts
      1. Font style elements: the TT, I, B, BIG, SMALL, STRIKE, S, and U elements
      2. Font modifier elements: FONT and BASEFONT
    3. Rules: the HR element
  16. Frames - Multi-view presentation of documents
    1. Introduction to frames
    2. Layout of frames
      1. The FRAMESET element
      2. The FRAME element
    3. Specifying target frame information
      1. Setting the default target for links
      2. Target semantics
    4. Alternate content
      1. The NOFRAMES element
    5. Inline frames: the IFRAME element
  17. Forms - User-input Forms: Text Fields, Buttons, Menus, and more
    1. Introduction to forms
    2. The FORM element
    3. Controls
      1. The INPUT element
      2. The BUTTON element
      3. The SELECT, OPTGROUP, and OPTION elements
      4. The TEXTAREA element
    4. Labels
      1. The LABEL element
    5. Adding structure to forms: the FIELDSET and LEGEND elements
    6. Giving focus to an element
      1. Tabbing navigation
      2. Access keys
    7. Disabled and read-only elements
      1. Disabled elements
      2. Read-only elements
    8. Form submission
      1. Processing form data
      2. Which control values are submitted
  18. Scripts - Animated Documents and Smart Forms
    1. Introduction to scripts
    2. Designing documents for user agents that support scripting
      1. The SCRIPT element
      2. Specifying the scripting language
      3. Intrinsic events
      4. Dynamic modification of documents
    3. Designing documents for user agents that don't support scripting
      1. The NOSCRIPT element
      2. Commenting out scripts
  19. SGML reference information for HTML - Formal definition of HTML and validation
    1. Document Validation
    2. Sample SGML catalog
  20. SGML Declaration of HTML 4.0
    1. SGML Declaration
  21. Document Type Definition
  22. Transitional Document Type Definition
  23. Frameset Document Type Definition
  24. Character entity references in HTML 4.0
    1. Introduction to character entity references
    2. Character entity references for ISO 8859-1 characters
      1. The list of characters
    3. Character entity references for symbols, mathematical symbols, and Greek letters
      1. The list of characters
    4. Character entity references for markup-significant and internationalization characters
      1. The list of characters
  1. Changes between HTML 3.2 and HTML 4.0
    1. Changes to elements
      1. New elements
      2. Deprecated elements
      3. Obsolete elements
    2. Changes to Tables
    3. Changes to Forms
    4. Changes for internationalization
  2. Performance, Implementation, and Design Notes
    1. Representing non-ASCII characters in URLs
    2. SGML implementation notes
      1. Line breaks
      2. SGML features with limited support
      3. Boolean attributes
      4. Marked Sections
      5. Processing Instructions
      6. Shorthand markup
    3. Notes on helping search engines index your Web site
      1. Search robots
    4. Notes on tables
      1. Design rationale
      2. Recommended Layout Algorithms
    5. Notes on forms
      1. Incremental display
      2. Future projects
    6. Notes on scripting
      1. Reserved syntax for future script macros
    7. Notes on frames
      1. Frame target algorithm
    8. Notes on accessibility
      1. Generating alternate text
    9. Notes on security