HTML
  Home arrow HTML arrow Page 5 - XHTML Explained
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

XHTML Explained
By: Mitchell Harper
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 5
    2001-12-29

    Table of Contents:
  • XHTML Explained
  • XHTML Defined
  • XHTML Benefits
  • DTD's
  • XHTML Examples
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    XHTML Explained - XHTML Examples


    (Page 5 of 6 )

    As you can probably guess by now, XHTML code looks very similar to plain old HTML code, with just a couple of syntactic differences. Three examples of valid XHTML documents are shown below. They were validated using the W3C’s XHTML validation tool, located at http://validator.w3.org/.

    Example 1:

    This example used the strict DTD, meaning that every single tag must be closed properly, all attributes assigned values, etc:

    <?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> Strict DTD XHTML Example </title>

    </head>

    <body>

    <p>

    Please Choose a Day:

    <br /><br />

    <select name="day">

    <option selected="selected">Monday</option>

    <option>Tuesday</option>

    <option>Wednesday</option>

    </select>

    </p>

    </body>

    </html>


    Example 2:

    This example uses the transitional DTD, which provides support for older browsers that don’t recognize style sheets. You can see it uses several attributes within the <body> tag, which aren’t allowed when using the strict DTD:

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE html

    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

    "DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

    <head>

    <title> Transitional DTD XHTML Example </title>

    </head>

    <body bgcolor="#FFFFFF" link="#000000" text="red">

    <p>This is a transitional XHTML example</p>

    </body>

    </html>


    Example 3:

    This example uses the frameset DTD, which allows us to split one XHTML page into multiple frames, with each frame containing an XHTML page within it:

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE html

    PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"

    "DTD/xhtml1-frameset.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <title> Frameset DTD XHTML Example </title>

    </head>

    <frameset cols="100,*">

    <frame src="toc.html" />

    <frame src="intro.html" name="content" />

    </frameset>

    </html>

    More HTML Articles
    More By Mitchell Harper


     

    HTML ARTICLES

    - Hello HTML 5, Goodbye Gears
    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 10 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek