|
Home >> FAQs/Tutorials >> XHTML Tutorials and Tips >> Index
XHTML Tutorials - Introduction To Element Content Syntax
By: FYICenter.com
Part:
1
2
3
4
A collection of 17 tutorial tips on XHTML 1.0 element content syntax and basics. Clear answers are provided with tutorial exercises on XHTML element content models, EMTPY and PCDATA element contents, sub-element only contents, mixed contents, XHTML entities and CDATA, nested elements, white space characters.
Topics included in this collection are:
- What Is the XHTML Element Content?
- What Are the XHTML Element Content Models?
- What Are the XHTML Elements Defined with EMPTY Contents?
- What Are the XHTML Elements Defined with PCDATA Contents?
- What Are the XHTML Elements Defined with Sub-elements Contents?
- What Are the XHTML Elements Defined with Mixed Contents?
- What Is PCDATA?
- What Is an XHTML Entity?
- What Is CDATA?
- What Is a Sub-element?
- Can Two Elements Partially Overlap Each Other?
- What Is the Sequence of Sub-elements?
- What Is a Required Sub-element?
- What Is a White Space Character?
- How Exactly White Space Characters Are Ignored?
- How To Get an Extra White Space?
Please note that all tutorials in this collection are based on XHTML 1.0 specification.
What Is the XHTML Element Content?
The content of an XHTML element is everything you entered between the opening tag and
the closing tag of the element.
Here are some good examples of XHTML element contents:
<!-- An empty table cell -->
<td></td>
<!-- "title" content: A simple text string -->
<title>My First XHTML Document</title>
<!-- "head" content: Another XHTML element -->
<head>
<title>My First XHTML Document</title>
</head>
<!-- "p" content: Text and another element -->
<p>The nature of <em>yin and yang</em> is relative.</p>
What Are the XHTML Element Content Models?
There are 4 content models defined for XHTML elements:
1. EMPTY - No content. Nothing between the opening tag and the closing tag. For example:
<br/> - "br" element has no content.
<br></br> - Same as above.
<meta name="Author" content="FYICenter.com"/>
2. PCDATA - Parsed Character DATA. A string of characters and character entities.
Empty content is allowed in this model.
But no other XHTML elements are allowed in the content.
<!-- PCDATA: Pure character string -->
<title>My First XHTML Document</title>
<!-- PCDATA: Empty string -->
<textarea rows="4" cols="40"></textarea>
<!-- PCDATA: Characters mixed with entities -->
<textarea rows="4" cols="40">
while ($i=0; $i<3; %i++) print "Knock ";
</textarea>
3. Sub-elements only - A sequence of sub-elements. No character strings are allowed
in the content.
<!-- Sub-elements only:
"head" can only take sub-elements like "title"
and "meta" -->
<head>
<title>My First XHTML Document</title>
<meta name="Author" content="FYICenter.com"/>
</head>
<!-- Sub-elements only:
"tr" can only take sub-elements like "td" -->
<tr>
<td>Author:</td>
<td>FYIcenter.com</td>
</tr>
<!-- Sub-elements only:
"ul" can only take sub-elements like "li" -->
<ul>
<li>My First XHTML Document</li>
</ul>
(Continued on next part...)
Part:
1
2
3
4
|