|
Home >> FAQs/Tutorials >> XHTML Tutorials and Tips >> Index
XHTML Tutorials - Introduction To Element Content Syntax
By: FYICenter.com
Part:
1
2
3
4
(Continued from previous part...)
What Is the Sequence of Sub-elements?
The sequence of sub-elements is the order of how each sub-element is placed
inside the parent element. For most parent elements, their sub-elements can be
placed in any order. But some parent elements require you to follow a predefined
sequence.
For example, element "html" requires that "head" to be placed first, and
"body" to be placed second.
What Is a Required Sub-element?
A required sub-element is a sub-element that you must included in the parent
element. Most sub-elements are optional. But there are some sub-elements that
are required by their parent elements.
Here are two good examples:
<!-- Valid: "head" requires "title" -->
<head>
<title>XHTML FAQs by FYIcenter.com</title>
</head>
<!-- Valid: "ul" requires "li" -->
<ul>
<li>Hope you like it.</li>
</head>
What Is a White Space Character?
A white space character is a character that leaves nothing on your screen.
There are 4 known white space characters:
- " " - The space character.
- "\t" - The tab character.
- "\n" - The new line character.
- "\r" - The carriage return character.
White space characters are generally ignored in XHMTL documents
except for element "pre" and CDATA.
How Exactly White Space Characters Are Ignored?
White space characters will be processed (ignored) based where they are located:
- White space characters will be ignored between block elements.
- White space characters will be preserved in element "pre".
- White space characters will be preserved in CDATA.
- Multiple consecutive white space characters will be replaced by
a single space character in PCDATA.
- White space characters will be ignored in EMPTY content elements.
How To Get an Extra White Space?
As you know that white space characters will be ignored in elements like "p".
So how to get some extra white space to show up in your text paragraphs?
On easy solution is to use XHTML entity: " ", which stands for
"non-breaking space".
Here is an example of using "nbsp":
<!-- 4 white spaces at the beginning of the paragraph -->
<p> There was once upon a time
a peasant-woman who had a daughter and a step-
daughter.</p>
Part:
1
2
3
4
|