HTML Topics: Tag Order |
Nesting
It is important to realize that start and end tags will often be nested in
the same way that brackets are nested, for example
<TAG1> <TAG2> <TAG3> ... </TAG3> </TAG2> </TAG1>or alternatively:
<TAG1> <TAG2> ... </TAG2> <TAG3> ... </TAG3> </TAG1>but one should not interleave start and terminator tags:
<TAG1> <TAG2> ... <TAG3> &</TAG2> ... </TAG3> </TAG1>and also not interleave the order of the terminator tags:
<TAG1> <TAG2> <TAG3> ... </TAG1> </TAG3> </TAG2>The use of incorrectly nested tags will normally lead to unexpected (and possibly undesirable) behaviour by the browser (which may indeed depend on the actual browser used). Note that tags are not normally indented as shown here, though this approach can be useful in certain cases as a visual check that tags are paired correctly.
© Copyright 1995-2006.
Birkbeck College, University of London.
|
Author(s):
Jeremy Karl Cockcroft Huub Driessen |