HTML: The Definitive Guide

Previous Appendix A Next
 

A.2 The Grammar

The grammar is a composite of the HTML 2.0 standard tags and special extensions to the language as enabled by the latest versions of NCSA Mosaic, Netscape Communication's Netscape Navigator, and Microsoft's Internet Explorer.

The rules are in alphabetical order. The starting rule for an entire document is named html_document.

a_tag ::= <a>  
    {a_content}_0  
    </a>  
a_content[1] ::= heading  
  | text  
address_tag ::= <address>  
    {address_content}_0  
    </address>  
address_content ::= p_tag  
  | text  
applet_content ::= {<param>}_0  
    body_content  
applet_tag ::= <applet>  
    applet_content  
    </applet>  
b_tag ::= <b> text </b>  
basefont_tag ::= <basefont>  
    body_content  
    </basefont>  
big_tag ::= <big>  
    text  
    </big>  
block ::= {block_content }_0  
block_content ::= <isindex>  
  | basefont_tag  
  | blockquote_tag  
  | center_tag  
  | dir_tag  
  | div_tag  
  | dl_tag  
  | form_tag  
  | listing_tag  
  | menu_tag  
  | nobr_tag  
  | ol_tag  
  | p_tag  
  | pre_tag  
  | table_tag  
  | ul_tag  
  | xmp_tag  
blockquote_tag ::= <blockquote>  
    body_content  
    </blockquote>  
body_content ::= <bgsound>  
  | <hr>  
  | address_tag  
  | block  
  | heading  
  | map_tag  
  | marquee_tag  
  | text  
body_tag ::= <body>  
    {body_content }_0  
    </body>  
caption_tag ::= <caption>  
    body_content  
    </caption>  
center_tag ::= <center>  
    body_content  
    </center>  
cite_tag ::= <cite> text </cite>  
code_tag ::= <code> text </code>  
content_style ::= cite_tag  
  | code_tag  
  | dfn_tag  
  | em_tag  
  | kbd_tag  
  | strong_tag  
  | var_tag  
dd_tag ::= <dd>  
    flow  
    </dd>  
dir_tag[2] ::= <dir>  
    { li_tag }  
    </dir>  
dfn_tag ::= <dfn> text </dfn>  
div_tag ::= <div>  
    body_content  
    </div>  
dl_content ::= dt_tag dd_tag  
dl_tag ::= <dl>  
    {dl_content }  
    </dl>  
dt_tag ::= <dt>  
    text  
    </dt>  
em_tag ::= <em> text </em>  
flow ::= {flow_content }_0  
flow_content ::= block  
  | text  
font_tag ::= <font> style_text </font>  
form_content[3] ::= <input>  
  | body_content  
  | select_tag  
  | textarea_tag  
form_tag ::= <form>  
    {form_content }_0  
    </form>  
frameset_content ::= <frame>  
  | noframes_tag  
frameset_tag ::= <frameset>  
    {frameset_content }_0  
    </frameset>  
h1_tag ::= <h1> text </h1>  
h2_tag ::= <h2> text </h2>  
h3_tag ::= <h3> text </h3>  
h4_tag ::= <h4> text </h4>  
h5_tag ::= <h5> text </h5>  
h6_tag ::= <h6> text </h6>  
head_content ::= <base>  
  | <isindex>  
  | <link>  
  | <meta>  
  | <nextid>  
  | title_tag  
head_tag ::= <head>  
    {head_content }_0  
    </head>  
heading ::= h1_tag  
  | h2_tag  
  | h3_tag  
  | h4_tag  
  | h5_tag  
  | h6_tag  
html_content ::= head_tag body_tag  
  | head_tag frameset_tag  
html_document ::= html_tag  
html_tag ::= <html>  
    html_content  
    </html>  
i_tag ::= <i> text </i>  
kbd_tag ::= <kbd> text </kbd>  
li_tag ::= <li>  
    flow  
    </li>  
listing_tag ::= <listing>  
    literal_text  
    </listing>  
map_content ::= {<area>}_0  
map_tag ::= <map>  
    map_content  
    </map>  
marquee_tag ::= <marquee>  
    style_text  
    </marquee>  
menu_tag[4] ::= <menu>  
    {li_tag }  
    </menu>  
nobr_tag ::= <nobr> text </nobr>  
noframes_tag ::= <noframes>  
    {body_content }_0  
    </noframes>  
ol_tag ::= <ol>  
    {li_tag }_1  
    </ol>  
option_tag ::= <option>  
    plain_text  
    </option>  
p_tag ::= <p>  
    text  
    </p>  
physical_style ::= b_tag  
  | big_tag  
  | i_tag  
  | font_tag  
  | small_tag  
  | s_tag  
  | strike_tag  
  | sub_tag  
  | sup_tag  
  | tt_tag  
  | u_tag  
pre_content ::= <br>  
  | <hr>  
  | a_tag  
  | style_text  
pre_tag ::= <pre>  
    {pre_content }_0  
    </pre>  
s_tag ::= <s> text </s>  
strike_tag ::= <strike> text </strike>  
select_tag ::= <select>  
    {option_tag }  
    </select>  
small_tag ::= <small> text </small>  
strong_tag ::= <strong> text </strong>  
sub_tag ::= <sub> text </sub>  
sup_tag ::= <sup> text </sup>  
table_cell ::= td_tag  
  | th_tag  
table_tag ::= <table>  
    [caption_tag]  
    {tr_tag }_0  
    </table>  
td_tag ::= <td>  
    body_content  
    </td>  
text ::= {text_content }_0  
text_content ::= <br>  
  | <img>  
  | <wbr>  
  | a_tag  
  | applet_tag  
  | content_style  
  | plain_text  
  | physical_style  
textarea_tag ::= <textarea> plain_text </textarea>  
th_tag ::= <th>  
    body_content  
    </th>  
title_tag ::= <title> plain_text </title>  
tr_tag ::= <tr>  
    {table_cell}_0  
    </tr>  
tt_tag ::= <tt> text </tt>  
u_tag ::= <u> text </u>  
ul_tag ::= <ul>  
    {li_tag }  
    </ul>  
var_tag ::= <var> text </var>  
wbr_tag ::= <wbr>  
xmp_tag ::= <xmp>  
    literal_text  
    </xmp>  

Footnotes:

[1]

a_content may not contain a_tags; you may not nest <a> tags within other <a> tags.[2]

The li_tag within the dir_tag may not contain any element found in a block.[3]

form_content may not contain form_tags; you may not nest one <form> within another <form>.[4]

The li_tag within the menu_tag may not contain any element found in a block.


Previous Home Next
Grammatical Conventions Book Index HTML Tag Quick Reference