HTML 4.0 Specification

W3C Recommendation 18-Dec-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].

Status of this document

This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.

W3C recommends that user agents and authors (and in particular, authoring tools) produce HTML 4.0 documents rather than HTML 3.2 documents (see [HTML32]). For reasons of backwards compatibility, W3C also recommends that tools interpreting HTML 4.0 continue to support HTML 3.2 and HTML 2.0 as well.

A list of current W3C Recommendations and other technical documents can be found at http://www.w3.org/TR.

Public discussion on HTML features takes place on www-html@w3.org.

Available formats

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

A plain text file:
http://www.w3.org/TR/REC-html40-971218/html40.txt (723Kb),
A gzip'ed tar file containing HTML documents:
http://www.w3.org/TR/REC-html40-971218/html40.tgz (339Kb),
A zip file containing HTML documents (this is a '.zip' file not an '.exe'):
http://www.w3.org/TR/REC-html40-971218/html40.zip (372Kb),
A Postscript file:
http://www.w3.org/TR/REC-html40-971218/html40.ps (4.4Mb, 363 pages),
A PDF file:
http://www.w3.org/TR/REC-html40-971218/html40.pdf (2.1Mb) file.

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

Available languages

The English version of this specification is the only normative version. However, for translations of this document, see http://www.w3.org/MarkUp/html40-updates/translations.html.


The list of known errors in this specification is available at http://www.w3.org/MarkUp/html40-updates/html40-errata.html

Please report errors in this document to www-html-editor@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
    4. Copyright Notice
  2. Introduction to HTML 4.0
    1. What is the World Wide Web?
      1. Introduction to URIs
      2. Fragment identifiers
      3. Relative URIs
    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. Authoring 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. Character references
    3. How to read the HTML DTD
      1. DTD Comments
      2. Parameter entity definitions
      3. Element declarations
      4. Attribute declarations
  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
      1. Numeric character references
      2. Character entity references
    4. Undisplayable characters
  6. Basic HTML data types - Character data, colors, lengths, URIs, content types, etc.
    1. Case information
    2. SGML basic types
    3. Text strings
    4. URIs
    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. Style sheet data
    16. 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 references 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, ABBR, and ACRONYM
      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. Visual rendering of lists
    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 URIs
  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. Notes on embedded documents
    6. Image maps
      1. Client-side image maps: the MAP and AREA elements
      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 - Adding style to HTML documents
    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
    3. External style sheets
      1. Preferred and alternate style sheets
      2. Specifying external style sheets
    4. Cascading style sheets
      1. Media-dependent cascades
      2. Inheritance and cascading
    5. Hiding style data from user agents
    6. Linking to style sheets with 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
      2. Long descriptions of frames
    5. Inline frames: the IFRAME element
  17. Forms - User-input Forms: Text Fields, Buttons, Menus, and more
    1. Introduction to forms
    2. Controls
      1. Control types
    3. The FORM element
    4. The INPUT element
      1. Control types created with INPUT
      2. Examples of forms containing INPUT controls
    5. The BUTTON element
    6. The SELECT, OPTGROUP, and OPTION elements
      1. Preselected options
    7. The TEXTAREA element
    8. The ISINDEX element
    9. Labels
      1. The LABEL element
    10. Adding structure to forms: the FIELDSET and LEGEND elements
    11. Giving focus to an element
      1. Tabbing navigation
      2. Access keys
    12. Disabled and read-only controls
      1. Disabled controls
      2. Read-only controls
    13. Form submission
      1. Form submission method
      2. Successful controls
      3. Processing form data
      4. Form content types
  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. Hiding script data from user agents
  19. SGML reference information for HTML - Formal definition of HTML and validation
    1. document 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 attributes
    3. Changes for accessibility
    4. Changes for meta data
    5. Changes for text
    6. Changes for links
    7. Changes for tables
    8. Changes for images, objects, and image maps
    9. Changes for forms
    10. Changes for style sheets
    11. Changes for frames
    12. Changes for scripting
    13. Changes for internationalization
  2. Performance, Implementation, and Design Notes
    1. Notes on invalid documents
    2. Special characters in URI attribute values
      1. Non-ASCII characters in URI attribute values
      2. Ampersands in URI attribute values
    3. SGML implementation notes
      1. Line breaks
      2. Specifying non-HTML data
      3. SGML features with limited support
      4. Boolean attributes
      5. Marked Sections
      6. Processing Instructions
      7. Shorthand markup
    4. Notes on helping search engines index your Web site
      1. Search robots
    5. Notes on tables
      1. Design rationale
      2. Recommended Layout Algorithms
    6. Notes on forms
      1. Incremental display
      2. Future projects
    7. Notes on scripting
      1. Reserved syntax for future script macros
    8. Notes on frames
    9. Notes on accessibility
    10. Notes on security
      1. Security issues for forms

Copyright  ©  1997 W3C (MIT, INRIA, Keio ), All Rights Reserved.