Depends on the doctype you're using, you'll have different rules to follow. I use XHTML 1.0 Strict for all of my projects, and I can check proper nesting of tags at http://www.december.com/html/x1/. That site will tell me which tags are allowed to be placed in which other tags, etc.
For example, The Anchor Tag in XHTML 1.0 Strict:
tag: a
content: ( #PCDATA | br | span | bdo | map | object | img | tt | i | b | big |
small | em | strong | dfn | code | q | samp | kbd | var | cite | abbr |
acronym | sub | sup | input | select | textarea | label | button |
ins | del | script )*
parents: abbr acronym address b bdo big caption cite code dd del dfn div dt em
fieldset h1 h2 h3 h4 h5 h6 i ins kbd label legend li object p pre q
samp small span strong sub sup td th tt var
You can also view rules for: