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 Closing Rule Bookmark and Share
Tutorial Home
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
XHTML elements must always be closed. For example consider the following HTML code:

<p>This is a paragraph.
<p>This is another paragraph.

The above code is invalid in XHTML. XHTML tag / element closing rule forces us to properly close our ALL tags. So, the correct version of the above code is as under:

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

You might be thinking about the EMPTY html tags (tags that have no matching closing tags e.g. <img>, <br>, etc). XHTML rules tell us to put a forward slash "/" just before puting ">" to mark the close of an HTML tag. To understand it clearly just consider the following HTML code example:

Line Break Tag: <br>
Image Tag: <img src="image.gif">
Horizontal Rule Tag: <hr>
Input Tag: <input type="text" name="txt">

The above code is not valid XHTML. A valid XHTML version of the above code is as under:

Line Break Tag: <br />
Image Tag: <img src="image.gif" />
Horizontal Rule Tag: <hr />
Input Tag: <input type="text" name="txt" />
Next >>> Lesson No. 5: XHTML Tag and Attribute Rules





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