HTML and CSS Reference
In-Depth Information
The %inline; entity includes lots of stuff: special elements, font-style
elements, phrase elements, and inline form elements. %misc includes the
ins, del, script , and noscript elements. You can read the HTML DTD
for the other entity declarations to see which elements are also allowed
as the contents of a p element.
Why did the HTML DTD authors break up all these elements into separ-
ate groups? If they were simply defining elements to be included in the
p element, they could have built a single long list. However, HTML has
rules that govern where inline elements may appear in a document. The
authors grouped elements that are treated similarly into separate entit-
ies that could be referenced several times in the DTD. This makes the
DTD easier to read and understand, as well as easier to maintain when
a change is needed.
15.4.5. Empty Elements
Elements whose content is defined to be empty deserve a special men-
tion. XML introduced notational rules for empty elements, different from
the traditional HTML rules that govern them.
HTML authors are used to specifying an empty element as a single tag,
such as <br> or <img> . XML requires that every element have an open-
ing and a closing tag, so an image tag would be written as <img></img> ,
with no embedded content. Other empty elements would be written in a
similar manner.
Because this format works well for nonempty tags but is a bit of overkill
for empty ones, you can use a special shorthand notation for empty
tags. To write an empty tag in XML, just place a slash ( / ) immediately
before the closing angle bracket of the tag. Thus, you can write a line
break as <br/> and an image tag as <img src="myimage.gif"/> . Notice
that the attributes of the empty element, if any, appear before the clos-
ing slash and bracket.
 
Search WWH ::




Custom Search