SubHTML Specification

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

Version

The convergent version of this document is 230-7.

Scope

The SubHTML specification defines a subset of HTML that is optimized to produce documents that are simple, safe, and compatible even with minimalist web browsers like Dillo, according to the goals of SubWeb.

This specification only focuses on the syntax, structure, elements, and attributes that would be REQUIRED to be supported by a SubWeb-compliant web browser.

It does not includes elements, attributes, values, and features that MAY still be used in a SubWeb-compliant page because they degrade gracefully if support is not implemented. If an element is not listed, it doesn’t necessarily mean that it is not permitted.

As a general rule, elements, attributes and features that are related to scripting (<script>) or embedding external content (<object>, <iframe>, <audio>, <video>, etc.) are not permitted and MUST NOT be used in SubHTML documents, unless otherwise specified (see the rules concerning appropriate usage of the <link> and <img> tag).

For each recommended element and common attribute, links to the Mozilla Developer Network HTML Reference are included to help users who want to learn more about a specific element or attribute. Note however that not every aspect of referenced elements or attributes is supported or permitted in SubHTML documents.

Syntax

The following sections outline the main syntactic restrictions introduced in SubHTML.

Elements

Elements are represented wrapped in HTML tags. They can be normal elements which may contain other tags or text, or void elements, with no content.

In SubHTML: - Closing tags MUST be used for normal elements. - Void elements MAY include a slash before the closing >.

In other words:

<ul>
  <li>first item
  <li>second item 
<ul>

Is invalid SubHTML, because the closing </li> tags MUST be specified, but both <br> and <br/> are permitted.

Attributes

Attribute values MUST be specified, unless in case of boolean attributes, in which case they MAY be omitted. In other words, all the following syntaxes are permitted and equivalent:

<input type="text" disabled="disabled" />
<input type="text" disabled="" />
<input type="text" disabled />

Document Structure

A SubHTML document MUST be structured respecting the following tag hierarchy:

<!DOCTYPE html>
<html>
  <head>
    <title>A SubWeb web site</title>
    <link rel="stylesheet" href="/styles.css">
  </head>
  <body>
    <!-- document content goes here -->
  </body>
</html>

DOCTYPE

A document MUST have the following DOCTYPE declaration before the <html> element:

<!DOCTYPE html>

This means that SubHTML documents are in fact valid HTML5 documents.

Comments

A document MAY contain comments delimited by <!-- and -->, which can be placed within any elements and span multiple lines.

html

A document MUST be wrapped in a single <html> element.

<html>

head

This element defines the header of the document and MAY contain links to external files.

<head>

title

This element defines the title of the document, to be displayed in the browser title bar or the tab displaying the page; it can only contain text.

<title>

link

This element defines a relationship between the current document and an external resource, such as a stylesheet.

<link>

href attribute

This attribute is REQUIRED and MUST be set to a URL to the linked external resource. It MAY be an external or absolute URL, but it MUST have the same origin of the current document. External URLs are forbidden.

rel attribute

This attribute is REQUIRED and defines the type of relationship between the document and the linked resource.

One or more of the following values MUST be specified as a space-separated list:

  • stylesheet: an external CSS stylesheet.
  • alternate: an alternate representation of the current documents e.g. an RSS or Atom feed.
  • icon: an icon used to identify the document (favicon).
type attribute

This attribute is REQUIRED and defines the data type of the referenced resource. It can MAY be set to a valid MIME type, depending on the value of the rel attribute, e.g. text/css for stylesheets or image/png for icons.

body

This element represents the content of a document, and it contains all other content elements. There can only be one <body> element per document.

<body>

Block Elements

Block elements always start a new line when added to the document, unless styled differently via CSS (which is NOT RECOMMENDED).

blockquote

This element is used for extended quotations.

<blockquote>

br

This element can be used to force a line break in the text.

<br>

div

This element defines a division within the document and SHOULD be used whenever a generic block container is needed.

Using the class attribute is RECOMMENDED to convey a specific meaning or purpose, typically resulting in a different styling.

Note that <div> elements can be nested.

<div>

h1, h2, h3, h4, h5, h6

These elements are used to define headings within a document, and structure it in hierarchical, titled sections. Note that:

  • There MUST exactly one <h1> element in the whole document.
  • They MUST be used in sequential order, without skipping levels.

<h1>, <h2>, <h3>, <h4>, <h5>, <h6>

hr

This element is used for creating horizontal breaks within the document.

<hr>

img

This element is used to embed images into the document.

<img>

alt attribute

This attribute is REQUIRED and MUST be set to some alternative text that will be displayed if the image is cannot be rendered.

src attribute

This attribute is REQUIRED and MUST be set to a URL resolving to an image in one of the following format: PNG, JPG, or GIF. It MAY be an external or absolute URL, but it MUST have the same origin of the current document. External URLs are forbidden.

p

This element is used to define a paragraph of text.

<p>

pre

This element is used to represent preformatted text, which SHOULD be rendered by the browser exactly as written, preserving spaces and line breaks.

<pre>

Inline Elements

Inline elements are used to partition text within the same block, and do not cause a new line to start.

a

This element is used to define an anchor in the text that can be referenced by other parts of the document or a link to another place in the same or another document, when the href element is specified.

Note that when used as an anchor, the id attribute is REQUIRED.

<a>

href attribute

This attribute is REQUIRED when the a element is used as a link, and MUST be set to one of the following:

  • a URL to the linked external resources. It MAY be an external or absolute URL.
  • a #-prefixed anchor id defined within the same document.

Note that protocols and pseudo-protocols understood by the browser MAY be used (for example tel: or mailto:) but they SHOULD be styled in different ways to provide a clear indication to the user that clicking such link MAY result in opening another application. Similarly, links pointing to external HTTP(s) content SHOULD also be styled differently.

The javascript: pseudo-protocol is forbidden and MUST NOT be used.

rel attribute

This attribute MAY be used to specify the relationship with the linked content. In particular, it SHOULD be set to subweb when linking to external documents conforming to the SubWeb specifications defining specific HTML and CSS subset.

code

This element is used to represent a short fragment of source code. If wrapped within a <pre> element, it MAY be used to represent a block of source code.

<code>

em

This element is used for emphasized text.

<em>

span

This element defines an inline partition within a block of text and SHOULD be used whenever a generic inline container is needed.

Using the class attribute is RECOMMENDED to convey a specific meaning or purpose, typically resulting in a different styling.

Note that <span> elements can be nested.

<span>

strong

This element is used for strongly-emphasized text.

<strong>

Lists

Lists can be of three kinds:

  • ordered lists
  • unordered lists
  • description lists

dd

This element defines the definition of a term which was previously defined using a <dt> element which MUST be immediately preceding.

<dd>

dl

This element is used to wrap a description list comprised of terms (<dt> elements) and definitions (<dd> elements).

<dl>

dt

This element MUST be used within a <dl> element and identifies a term which is then defined via a dd element that MUST be immediately following.

<dt>

li

This element MUST be used within an <ol> or an <ul> and represents an item within a list. It can contain other content elements (except other <li> elements).

<li>

ol

This element represents an ordered list and MUST contain one or more <li> element.

<ol>

ul

This element represents an unordered list and MUST contain one or more <li> element.

<ul>

Forms

Forms enable the user to modify or input data fields using interactive controls and submit it to the server.

button

This element is an interactive button that can be pressed using the mouse, keyboard, etc. It MUST either submit the form data to the server or reset the form, depending on the value of its type attribute.

This element MUST be a child of a <form> element.

<button>

type attribute

This attribute SHOULD be specified for each button and MUST be set to one of the following values:

  • submit, to submit the form data to the server (default).
  • reset, to reset all form controls to their initial value.

form

This element wraps a form comprised of one or more interactive controls and a button, and can be used to send data to the server.

<form>

method attribute

This attribute SHOULD be specified to set the HTTP method to use to submit data to the server.

Possible values are:

  • get (default): Form data is appended to the URL using query parameters.
  • post: form data is sent as part of the request body (RECOMMENDED).
action attribute

This attribute SHOULD be specified to set the URL to send the data to. If not specified, the current URL will be used; if specified, it MUST be set to either a relative URL or an absolute URL with the same origin as the current document.

enctype method

This attribute SHOULD be specified and set to one of the following values:

  • application/x-www-form-urlencoded (default)
  • multipart/form-data: Used to upload files.
  • text/plain: Used mainly for debugging purposes.

input

This element is used to create interactive controls that can be used to set data to send to the server.

This element MUST be a child of a <form> element.

<input>

name attribute

This attribute MUST be specified to define the name of the field to submit to the server.

type attribute

This attribute SHOULD be specified and it SHOULD be set to one of the following values (although others may be supported by modern browsers):

  • text: a single line of text (default)
  • password: a password (characters are displayed as masked)
  • checkbox: a Boolean value
  • radio: A radio button for selecting one option
  • file: a file to upload
  • hidden: hidden text

label

This element specifies the label for an interactive control of a form such as an <input>, <select>, or <textarea> element.

This element MUST be a child of a form element.

<label>

for attribute

This attribute MUST be specified for each <label> element and it MUST be set to the id of the form control element it refers to, unless the <label> tag also includes a single form control element as a direct child, in which case the association SHOULD be determined automatically:

<label>
  Name:
  <input type="text" id="name" />
</label>

option

This element is used to define an option selectable from a <select> element, and it MUST be a child element of a <select> element.

<option>

value attribute

This attribute SHOULD be specified to set the value of the <option> element that will be sent to the server when the form is submitted.

select

This element defines an interactive form control that allows the user to select an option from a list of <option> elements.

This element MUST be a child of a <form> element.

<select>

name attribute

This attribute MUST be specified to define the name of the field to submit to the server.

textarea

This element represents an interactive form control that can be used to input multiple lines of text.

This element MUST be a child of a <form> element.

<textarea>

name attribute

This attribute MUST be specified to define the name of the field to submit to the server.

Tables

Tables are used to represent tabular data that is displayed in rows and columns.

table

This element represents a table, and MUST contain at least one row (<tr>) containing one cell (<td>).

<table>

td

This element represents a table cell, it MUST be a child of a <tr> element and MAY contain other content elements as direct children, except for <td> or <th> elements.

<td>

th

This element represents a table cell header, it MUST be a child of a <tr> element and MAY contain other content elements as direct children, except for <td> or <th> elements.

<th>

tr

This element represents a table row. It MUST be contained within a <table> element, and it MAY contain only <td> or <th> elements.

<tr>

Common Attributes

These attributes are common to all elements and they are OPTIONAL, unless otherwise specified.

class

Specifies one or more CSS class names for styling an element.

This element is RECOMMENDED especially for <span> and <div> elements.

class

id

Defines a unique identifier for the element within the document.

This attribute is REQUIRED in the following cases:

  • for an <a> element, if used to represent an anchor
  • for a <form> control, if a label is associated to it.

role

Defines the semantic meaning of an element. This attribute is RECOMMENDED for <div> and <span> elements to provide sufficient accessibility to these otherwise generic tags.

The value of this attribute SHOULD be set to a valid WAI-ARIA role, although arbitrary values MAY also be used as needed.

role

About

Originally written by Fabio Cevasco on 2026-08-23.

License

Creative Commons — CC BY 4.0