Tuesday 7, February 2012
Welcome Guest, Register | Login  
      Home    |    Tutorials    |    Free Ebooks    |    Free Scripts    |    Articles    |    Blog     |    Forum    |    About Us    |    Contact Us

XHTML vs HTML

  1. XHTML elements must be properly nested
  2. XHTML elements must always be closed
  3. XHTML elements must be in lowercase
  4. XHTML documents must have one root element

XHTML Elements Must Be Properly Nested
In HTML, some elements can be improperly nested within each other, like this:

This text is bold and italic

In XHTML, all elements must be properly nested within each other, like this:
This text is bold and italic
A common mistake with nested lists, is to forget that the inside list must be within

  • and
  • tags.

    This is wrong:


       
    • Coffee

    •  
    • Tea
         

             
      • Black tea

      •      
      • Green tea

      •    

       
    • Milk

     

    This is correct:


       
    • Coffee

    •  
    • Tea
         

             
      • Black tea

      •      
      • Green tea

      •    

       

    •  
    • Milk


    Notice that we have inserted a tag after the tag in the "correct" code example.
    XHTML Elements Must Always Be Closed

     

    Non-empty elements must have an end tag.
    This is wrong:

    This is a paragraph

    This is another paragraph

    This is correct:

    This is a paragraph


    This is another paragraph

     

    Empty Elements Must Also Be Closed
    Empty elements must either have an end tag or the start tag must end with />.

    This is wrong:
    A break:

    A horizontal rule:



    An image: Happy  face

     

    This is correct:
    A break:

    A horizontal rule:



    An image: Happy  face

     

    XHTML Elements Must Be In Lower Case
    The XHTML specification defines that the tag names and attributes need to be lower case.

    This is wrong:

    This is a paragraph


     

    This is correct:

    This is a paragraph


     

    XHTML Documents Must Have One Root Element
    All XHTML elements must be nested within the root element. All other elements can have sub (children) elements. Sub elements must be in pairs and correctly nested within their parent element. The basic document structure is:


    ...
    ...

     
         
       
    XHTML Tutorial
     
      Introduction
    Introduction
      Why XHTML
    Why XHTML
      XHTML vs HTML
    XHTML vs HTML
      XHTML Syntax
    XHTML Syntax
      XHTML VALIDATOR
    XHTML VALIDATOR
      XHTML Modules
    XHTML Modules
     
     
     
    Web Designing Tutorials
      HTML Tutorial
    HTML Tutorial
      DHTML Tutorial
    DHTML  Tutorial
      CSS Tutorial
    CSS Tutorial
      XHTML Tutorial
    XHTML Tutorial
     
    Programming Languages Tutorials
      C Language Tutorial
    C Language Tutorial
      C++ Tutorial
    C++ Tutorial
      Java Language Tutorial
    Java Language Tutorial
      Data Structure Theory Tutorial
    Data Structure Theory Tutorial
     
    Server Side Scripting Tutorials
      PHP Tutorial
    PHP Tutorial
      SQL Tutorial
    SQL Tutorial
      ASP Tutorial
    ASP Tutorial
     
    Client Side Scripting Tutorials
      JavaScript Tutorial
    JavaScript Tutorial
      VBScript Tutorial
    VBScript Tutorial
     
     
     
    POPULAR E-BOOKS
     
    Download Algorithms in the Real World: Lecture Notes  Ebook Algorithms in the Real World: Lecture Notes
       
    Download Practical PostgreSQL  Ebook Practical PostgreSQL
       
    Download The Leading Affiliate Money Machine Ebook The Leading Affiliate Money Machine
       
    Download Practical PHP Programming  Ebook Practical PHP Programming
       
    Download List Building For Beginners  Ebook List Building For Beginners
       
     
    Studiesinn.com © 2012 All Rights Reserved.
    Website Designed & Developed by TechXprtz