www.pickatutorial.com Computer Tutorials
Top eBooks: C/C++ | C# | Android | Mathematics | Database | Cloud | Graphics | Networking | Oracle | Hardware | AI
Top Tutorials: C/C++ | C#.NET | PHP MySQL | Java | Java Script | jQuery | HTML | xHTML | HTML5 | VB Script| CSS
Lessons XHTML Tag Nesting Rule Bookmark and Share
Tutorial Home
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
XHTML elements must be properly nested. When we write HTML, it is common to write code like following:

<strong><em>This text is bold and italic! </strong> </em>

The above code is invalid in XHTML. XHTML nesting rule dictates that the elements or tags must be properly nested i.e. the element that is opened last, in nesting, has to be closed first. The correct XHTML version of the above code example is:

<strong><em>This text is bold and italic! </em></strong>

It is very common to make mistakes in nesting lists. For example consider the following HTML code example:

<ul>
  <li>Rice</li>
  <li>Meat</li>
    <ol>
      <li>Beef</li>
      <li>Mutton</li>
    </ol>
  <li>Wheat</li>
</ul>

The above code displays properly in most of the web browsers, but the same is not valid XHTML. Note that in the third line of the above HTML code </li> is missing. The correct HTML code is as under:

<ul>
  <li>Rice</li>
  <li>Meat
    <ol>
      <li>Beef</li>
      <li>Mutton</li>
    </ol>
  </li>
  <li>Wheat</li>
</ul>


Next >>> Lesson No. 4: XHTML Tag Closing Rule







Home - Advertise - Contact - Disclaimer - About Us
© Since 2006 pickatutorial.com -- All Rights Reserved.