May 8, 2000
|
|
Tags And Attributes In XHTML
Requirements
Minimal XHTML
The following code, taken from the XHMTL proposed recommendation, is an example of a minimal XHTML 1.0 document:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Virtual Library</title> </head> <body> <p>Moved to <a href="http://vlib.org/">vlib.org</a>.</p> </body> </html>
Some specifics
XHTML documents must be well formed, strictly complying with syntax rules. Tags must be nested properly and all tags must either have closing tags, or be written in a form that combines the opening and closing tag.
The <head> and <body> elements cannot be omitted, and the <title> element must be the first element in the <head> element.
Nested tags. Tags must be nested properly and all tags must have closing tags or be written in a form that combines the opening and closing tag.
Empty elements. Empty elements must either have an end tag, or the start tag must end with />. This is sometimes called a self-terminating element.
Element and attribute names. XML is case-sensitive, and the XHTML DTDs, element, and attribute names must be in lower case. All attribute values must be quoted in single or double quotes:
Nested elements. Elements must also be properly nested, so that closing tags must be in reverse order of the opening tags.
No minimized attributes. XML, and therefore XHTML, does not support attribute minimization.
Script and style tags. Because any < and & characters are considered parts of tags in XHTML, any script and style tag sections must be wrapped in a CDATA section to otherwise ignore characters that would normally be considered markup. The only delimiter that's recognized in a CDATA section is the "]]>" string that ends the section. You can also use external script and style documents to solve the problem, as illustrated in the following example:
<script language="JavaScript"> <!-- <![CDATA[ // JavaScript code ]]> //--> </script>
Return to main story, "XHTML: A Bridge To The Future."
Back to This Week's Issue
Send Us Your Feedback
Top of the Page
ACCO Brands Corp seeking Director of New Product Development in Lincolnshire, IL
Transportation Security Administration seeking Chief Information Officer in Arlington, VA
Hebrew SeniorLife seeking Business Systems Analyst in Boston, MA
Trilogy Leasing seeking General Manager in Cranbury, NJ
UVIMCO seeking Senior Information Technology Leader in Charlottesville, VA
For more great jobs, career-related news, features and services, please visit our Career Center.