Loading Please Wait...

Logo Lynxsia IT Solutions

HTML And XHTML

HTML And XHTML

XHTML is HTML with XML support. XML is more Extensible Markup Language in which syntax must be strictly followed.

What is XHTML

XHTML is EXtensible HyperText Markup Language. Having all the features of HTML and XML makes XHTML more extensible and flexible.

IN XHTML all the elements must be properly formatted. In HTML we have learn that browser try to display web page even if there are markup errors such as no ending tag, no doctype, etc. But this must be corrected in XHTML so that browser display the correct information.

Common Difference Between HTML And XHTML

<!DOCTYPE> must be include.

xmlns attribute must be added in <html> tag.

<html>, <head>, <title>, and <body> elements must be defined.

Each and every element must be properly nested.

All elements must be closed even if it is empty tag like <br>

Element and attribute names must be in lowercase.

Attribute must be properly quoted.

Attribute must be fully described.

Must Have Elements And Attributes

<!DOCTYPE>, <html>, <head>, <title>, and <body> elements must be defined.

html and xmlns attribute must be added.

See below example for syntax with minimal requirement.

Let's see with some example
					 
        
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
              <title>Title of document</title>
            </head>
            <body>

              Body main content goes here...

            </body>
          </html>
        
      
Elements Nesting

All Elements must be properly nested accordingly one after another.

Let's see with some example
					 
        
          <!-- Correct Nesting -->
          <p><strong>Pragraph text</strong></p>

          <!-- Incorrect Nesting -->
          <p><strong>Pragraph text</p></strong>
        
      
Elements Must Be Closed

All Elements must have an ending tag. Even for empty element they must be closed too. Use / to close empty element at the end before greater than.

Let's see with some example
					 
        
          <!-- Correct -->
          <p>Pragraph text</p>

          <!-- Incorrect -->
          <p>Pragraph text

          <!-- For empty element use / at the end -->
          <br />
          <hr />
          <img src="" alt="" />
        
      
Elements And Attributes Must Be In Lowercase

All Element and attribute name must be they must be defined in lowercase only.

Let's see with some example
					 
        
          <!-- Correct -->
          <p style="color: red;">Pragraph text</p>

          <!-- Incorrect -->
          <P Style="color: red;">Pragraph text</P>
        
      
Attributes Must Be Quoted

Attribute values must be properly quoted.

Let's see with some example
					 
        
          <!-- Correct -->
          <img src="logo.png">

          <!-- Incorrect -->
          <img src=logo.png>
        
      
Attributes Must Be Fully Described

Attributes are fully described, no minimization allowed.

Let's see with some example
					 
        
          <!-- Correct -->
          <input type="text" disabled="disabled">
          <input type="checkbox" checked="checked">

          <!-- Incorrect -->
          <input type="text" disabled>
          <input type="checkbox" checked>
        
      

How you feel about this blog:

Share this blog on:

Report Us

If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com

Contact Us
Ads
Logo
Lynxsia IT Solutions

We are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..

Kotwali Road, Chhiptehri, Banda, 210001, UP, India

Copyright © 2022, Lynxsia IT Solutions, All rights reserved