HTML and CSS Reference
In-Depth Information
For example, the <p> tag that defines the start of a paragraph has a cor-
responding end tag, </p> , but the end tag rarely is used. In fact, many
HTML authors don't even know it exists. [ <p>, 4.1.2 ]
The HTML standard lets you omit a starting tag or ending tag whenever
it can be unambiguously inferred by the surrounding context. Many
browsers make good guesses when confronted with missing tags, lead-
ing the document author to assume that a valid omission was made.
We recommend that you almost always add the ending tag. It'll make
life easier for yourself as you transition to XHTML as well as for the
browser and anyone who might need to modify your document in the
future.
3.3.7. Ignored or Redundant Tags
HTML browsers sometimes ignore tags. This usually happens with re-
dundant tags whose effects merely cancel or substitute for themselves.
The best example is a series of <p> tags, one after the other, with no in-
tervening content. Unlike a text-processing tool, most browsers start to
a new line only once. The extra <p> tags are redundant and the browser
usually ignores them.
In addition, most HTML browsers ignore any tag that they don't under-
stand or that the document author specified incorrectly. Browsers ha-
bitually forge ahead and make some sense of a document, no matter
how badly formed and error ridden it may be. This isn't just a tactic to
overcome errors; it's also an important strategy for extensibility. Ima-
gine how much harder it would be to add new features to the language
if the existing base of browsers choked on them.
The thing to watch out for with nonstandard tags that aren't supported
by most browsers is their enclosed contents, if any. Browsers that re-
cognize the new tag may process those contents differently than those
that don't support the new tag. For example, older browsers, some of
which are still in use by many people today, don't support styles. Duti-
fully, they ignore the <style> tag, but then go on to render its contents
on the user's screen, effectively defeating the tag's purpose in addition
 
Search WWH ::




Custom Search