|
Home >> FAQs/Tutorials >> XHTML Tutorials and Tips >> Index
XHTML 1.0 Tutorials - Body Tag and Block Level Tags
By: FYICenter.com
Part:
1
2
3
4
5
6
(Continued from previous part...)
What Is Wrong with My P Elements?
If you are having trouble with your p elements, it could be caused by
one of the following common mistakes:
<!-- Missing closing tags -->
<body>
<p>I love the way you look at me.
<p>I love the way you kiss me.
</body>
<!-- "blockquote" is not allowed in a p element -->
<body>
<p><blockquote>
"You don't love a woman because she is beautiful,
but she is beautiful because you love her."
</blockquote></p>
</body>
<!-- "form" is not allowed in a p element -->
<body>
<p><form action="">
Take in this survey to win $10,000.00!
</form></p>
</body>
What Is a PRE Tag/Element?
A pre element is a block level element that can be used directly as
a sub-element in the body element. You can use pre elements to specify
blocks of pre-formatted text with white space characters preserved.
Here are basic rules about pre elements:
- "pre" elements are mixed content elements.
- "pre" elements can have empty contents.
- "pre" elements can have PCDATA as contents.
- "pre" elements can have in-line elements as contents.
- "pre" elements can not have block elements as contents.
- "pre" elements are block elements. They can not be used as in-line elements.
- "pre" elements will be displayed by browsers without line wrapping.
So long lines in the document will be displayed as long lines.
- "pre" elements will be displayed in monospacing fonts in browsers by default.
- "pre" elements preserve white space characters.
Here is a good example of pre elements:
<body>
<pre>
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
</pre>
</body>
Are Tab Characters Preserved in a PRE Element?
Yes. Tab characters are preserved in pre elements like other
white space characters.
Below is a good tutorial example of using "pre" elements:
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Tab Characters in PRE Elements</title>
</head>
<body>
<pre>
XHTML Extensible Hyper-Text Markup Language
HTML Hyper-Text Markup Language
XML Extensible Markup Language
</pre>
</body>
</html>
If you save the above document as tab.html, and view it with
Internet Explorer, you will see that tab characters are well preserved
by the browser. Line feed characters are also preserved as shown below:

(Continued on next part...)
Part:
1
2
3
4
5
6
|