---
# System prepended metadata

title: 'Section 4: Conformance: requirements and recommendations'
tags: [HTML4 SPEC]

---

---
tags: HTML4 SPEC
---

# Section 4: Conformance: requirements and recommendations

[link](https://www.w3.org/TR/html401/conform.html)

## Table of contents
- [Purpose](#Purpose)
- [Definitions](#Definitions)
- [SGML](#SGML)
- [The text/html content type](#The-texthtml-content-type)

## Purpose
Begin the specification of HTML 4, starting with the contract between:
- authors
- documents
- users
- user agents

## Definitions
- **HTML documents**
  - an SGML document / application
- **Author**
  - a person writes HTML documents
  - a program generates HTML documents
- **HTML user agent**
  - any device that interprets HTML documents
    - visual browsers (text-only and graphical)
    - non-visual browsers (audio, Braille)
    ![](https://i.imgur.com/aSDx8g0.png =350x300)
  - conforming user agent
    - A user agent should avoid imposing arbitrary length limits on attribute value
    -  A user agent must ensure that rendering is unchanged by the presence or absence of start tags and end tags when the HTML DTD indicates that these are optional
    -  For reasons of backwards compatibility, we recommend that tools interpreting HTML 4 continue to support HTML 3.2 and HTML 2.0
- **User**
  - a person who interacts with a user agent to view, hear, or otherwise use a rendered HTML document
- **Error conditions**
  - This specification does not define how conforming user agents handle general error conditions
  - recommended error handling behavior:
    - cannot recognize **element**: render the element's content
    - cannot recognize **attribute**: ignore the entire attribute
    - cannot recognize **attribute value**: use the default attribute value
    - encounters an **undeclared entity**:  treated as character data ([Recap: HTML Entity](https://www.w3schools.com/html/html_entities.asp))
- **Deprecated**
  - Specification clearly indicate which are deprecated
  - Deprecated elements may become **obsolete** in future versions of HTML
  - User agents should continue to support deprecated elements
  - Example: 
    - HTML presentational attributes have been deprecated when **style sheet** alternatives 
- **Obsolete**
  - obsolete element or attribute is one for which there is **no guarantee** of support by a user agent

## SGML
:::info
HTML 4 is an SGML application
:::
- User agents must not render SGML processing instructions (e.g., \<?full volume\>) or comments (Refer to [SGML limited support](https://www.w3.org/TR/html401/appendix/notes.html#sgmlfeatures))

&nbsp;

:::info
HTML 4.01 specifies **three DTDs**, so authors must include one of the following **document type declarations** in their documents
:::
- [HTML 4.01 Strict DTD](https://www.w3.org/TR/html401/sgml/dtd.html)
  - includes all elements and attributes that have not been deprecated or do not appear in frameset documents
  - `<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">`
- [HTML 4.01 Transitional DTD](https://www.w3.org/TR/html401/sgml/loosedtd.html)
  - includes everything in the strict DTD plus deprecated elements and attributes (most of which concern visual presentation)
  - `<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">`
- [HTML 4.01 Frameset DTD](https://www.w3.org/TR/html401/sgml/framesetdtd.html)
  - includes everything in the transitional DTD plus frames as well
  - `<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
        "http://www.w3.org/TR/html4/frameset.dtd">`
- **Compare: Strict DTD vs Transitional DTD**
<pre>
=================== Headings =========================================

There are six levels of headings from H1 (the most important) to H6 (the least important).

<!ELEMENT (%heading;)  - - (%inline;)* -- heading -->
<!ATTLIST (%heading;)
  %attrs;                              -- %coreattrs, %i18n, %events --
  >
</pre>

<pre>
=================== Headings =========================================

There are six levels of headings from H1 (the most important) to H6 (the least important).

<!ELEMENT (%heading;)  - - (%inline;)* -- heading -->
<!ATTLIST (%heading;)
  %attrs;                              -- %coreattrs, %i18n, %events --
  <font color="#f00">%align;                              -- align, text alignment --
  ></font>
</pre>
- **Compare: Transitional DTD vs Frameset DTD**
<pre>
<!ENTITY % HTML.Version "-//W3C//DTD HTML 4.01 Transitional//EN"
  -- Typical usage:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    ...
    </head>
    <body>
    ...
    </body>
    </html>
</pre>

<pre>
<!ENTITY % HTML.Version "-//W3C//DTD HTML 4.01 <font color="#f00">Frameset</font>//EN"
  -- Typical usage:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 <font color="#f00">Frameset</font>//EN"
            "http://www.w3.org/TR/html4/<font color="#f00">frameset</font>.dtd">
    <html>
    <head>
    ...
    </head>
    <font color="#f00"><frameset></font>
    ...
    <font color="#f00"></frameset></font>
    </html>
</pre>

## The text/html content type

HTML documents are sent over the Internet as a sequence of bytes accompanied by encoding information.

A HTTP-message is either a request or a response:
```
HTTP-message   = Request | Response
```

A HTTP-message has zero or more message-header⁠s and may have a message-body:
```
generic-message = start-line
                     *(message-header CRLF)
                     CRLF
                     [ message-body ]
```

So not every HTTP-message has a message-body. But if it has a message-body, then that’s also the entity-body:
```
message-body = entity-body
               | <entity-body encoded as per Transfer-Encoding>
```

Entity Body (Request):
```
POST /foo HTTP/1.1          # Not part of the entity.
Content-Type: text/plain    # ┬ The entity is from this line down...
Content-Length: 1234        # │
                            # │
Hello, World! ...           # ┘
```

Entity Body (Response):
```
HTTP/1.1 200 OK             # Not part of the entity.
Content-Length: 438         # ┬ The entity is from this line down...
Content-Type: text/plain    # │
                            # │
Response body ...           # ┘
```

:::info
A message entity with a content type of "text/html" represents an HTML document.
:::

The **content type** for HTML documents is defined as follows:

- **Content type name**: text
- **Content subtype name**: html
- **Required parameters**: none
- **Optional parameters**: charset
- **Encoding considerations**: any encoding is allowed
- **Security considerations**: See the notes on security

&nbsp;

:::info
How to specify this information ?
:::

```php
<?php
header('Content-Type: text/html; charset=utf-8');
...
?>
```

To address server or configuration limitations, HTML documents may include explicit information about the document's character encoding; the META element can be used to provide user agents with this information.

```htmlembedded
<META http-equiv="Content-Type" content="text/html; charset=EUC-JP">
```