Specification
Contents
Next

3.2 SGML Constructs used in HTML

3.2.1 Elements

Optional end-tags: The two cells in the table below should be displayed identically; the left cell uses end tags (or "net-enabled" start tags for empty elements, which are needed in XHTML), the right cell leaves off the end tags for the elements which declare the end tags optional. All elements on both sides are declared with a minimum of attributes.

Line
Breaks
Blue-White Image Horizontal Rule

Paragraph One

Paragraph Two

DL Term
DL Definition
  • List Item 1
  • List Item 2
Input
Options in a select Table sub-elements (left column will be 100 pixels, and right column will be 200 pixels if the COL and COLGROUP elements are accepted):
Header RowHeader, Column 2
Footer RowFooter, Column 2
Body 1 RowBody 1, Column 2
Body 2 RowBody 2, Column 2
Line
Breaks
Blue-White Image Horizontal Rule

Paragraph One

Paragraph Two

DL Term
DL Definition
  • List Item 1
  • List Item 2
Input
Options in a select Table sub-elements (left column will be 100 pixels, and right column will be 200 pixels if the COL and COLGROUP elements are accepted):
Header RowHeader, Column 2
Footer RowFooter, Column 2
Body 1 RowBody 1, Column 2
Body 2 RowBody 2, Column 2

3.2.3 Character references

These are the examples used by the specification:
The entity source should only be visible inside the parentheses; the character displayed in the "Character Reference" column should either be displayed similarly to the reference image (small differences in font face or size are okay) or replaced by an "unknown character" glyph, which is often simply a question mark.

Character descriptionCharacter ReferenceReference Image
Ampersand (&)&[reference image]
Less Than (&lt;)<[reference image]
Greater Than (&gt;)>[reference image]
Quote (&quot;)"[reference image]
Lower case A with Circle (&#229;)å[reference image]
Cyrillic Capital Letter I (&#1048;)И[reference image]
Kanji for Water (&#x6C34;)[reference image]
A more extensive test for character references can be found on Robin Lionheart's site.

3.2.4 Comments

There should not be any yellow cells in the table below with text. If there is text in the table below, it will explain how the browser has mishandled the comment. If the text in a cell does not start with "Browser", the output may be a side effect of another error.

Browser incorrectly treats "<!-->" as empty comment. -->
Browser incorrectly treats "<!--->" as empty comment. -->

B.3 SGML Implementation Notes

Specification

B.3.1 Line breaks

From the specification:

SGML (see [ISO8879], section 7.6.1) specifies that a line break immediately following a start tag must be ignored, as must a line break immediately before an end tag. This applies to all HTML elements without exception.

Therefore, there should only be one line of preformatted text below, even though there is a line break after the start tag for the bold text and one before the end tag.

This is one line of preformatted text. 
This is bold text, still on line one.
 This is after the bold text, but should still be line one.

It is rare for browsers to support the SGML constructs below, so I will be impressed if someone can tell me of a browser that supports all of them correctly (mauvecloud at mauvecloud dot net (mailto link avoided to discourage spam generators))

B.3.5 Marked Sections

There is a CDATA section between the curly braces on the next line:
{ < << <<< <<<< <<<<< <<<<<< <<<<<<<]]>}

The line above should look like one of the two lines below, but the spec does not make it entirely clear which is correct.
{<This> <<is> <<<the> <<<<contents> <<<<</of> <<<<<<the> <<<<<<<CDATA> <<<<<<<<section.>}
{}

B.3.6 Processing Instructions

Two SGML page break tags are below, but according to section 4.2,

User agents must not render SGML processing instructions (e.g., <?full volume>) or comments.

Therefore, if there is anything other than the normal amount of space between the quote about it, your browser is not dealing with the processing instructions correctly.

B.3.7 Shorthand Markup

Inspired by a page called "Dark Side of the HTML" (author unknown), which had once been at http://www.best.com/~sem/dark_side/index.html (gone now), but this document uses a DOCTYPE tag, unlike the pages there (which makes lack of support for the SGML tricks uncertain). If shorthand markup is supported, the two right columns of the table below will be identical, and the text will look as described.

Shorthand TestedShorthand TagsNormal Tags
Net Tag

This is an h3 element.

Empty Start Tag
  • Unordered List Item 1 <>Unordered List Item 2
  • Unordered List Item 1
  • Unordered List Item 2
Empty End TagNormal Text Bold Text Normal Text Normal Text Bold Text Normal Text
Closed Start TagNormal Text Bold Italic Text Normal Text Normal Text Bold Italic Text Normal Text

Valid HTML 4.01!