IT Community - Software Programming, Web Development and Technical Support

HTML vs XHTML: Nesting, The Difference

This is a discussion on HTML vs XHTML: Nesting, The Difference within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; The move from html to xhtml is mainly because of the ability to use "Bad Code" withing the ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > HTML, CSS and Javascript Coding Techniques

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 07-07-2009, 11:01 PM
jesichamika jesichamika is offline
D-Web Trainee
 
Join Date: Jul 2009
Posts: 2
jesichamika is on a distinguished road
Default HTML vs XHTML: Nesting, The Difference

Quote:
The move from html to xhtml is mainly because of the ability to use "Bad Code" withing the html walls.. Here i will try to explain the proper "NESTING" techniques..

Code:

Example.. This code would work fine for HTML.. Not for XHTML:
<html>
<head>
<title>This will work...</title>
<body>
<h1>This is the line with the bad html.. notice i don't the close the h1 or the head
</body>

So with the combination of the XML document (used for describing the data) and HTML (used for displaying the data) every piece of information needs to be valid code..


Code:

Example.. This code would work fine for XHTML.. :
<html>
<head>
<title>This will work...</title>
</head>
<body>
<h1>Now i have closed all the tags properly.. now it is NESTED correctly</h1>
</body>
</html>

The proper NESTING of old tags..
With old HTML documents you were able to completely get the tags the wrong way around but it would still be displayed correctly..

Take the following code for example:
Code:

Old HTML Style: (invalid XHTML)
<u><b>Take note of where i am placing the closure of the tags..</u></b>

Now with the implementation of proper XHTML NESTING:
Code:

New XHTML Style: (valid XHTML because it is properly NESTED)
<u><b>Now take note of the order in which i place the closure of the tags..</b></u>

YOU MUST ALWAYS CLOSE XHTML TAGS... YOU MUST

Paragraphs, Page Breaks, Horizontal Rules, Images etc.... It's all changed..

Take the following form of VALID HTML:
Code:

This is not valid XHTML though.. Remember that...
<p> This is all you used to need for paragraphs
<p> Now i would have two
<hr> Now i would have also added a Horizontal Rule
<br> And a page Break..
<img src="http://forums.learnwebdesign.org/styles/prosilver/imageset/site_logo.gif" alt="LWD logo">
Yet all of this would have been acceptable....

But now with the use of XHTML to be NESTED and valid the previous would need to look like this:
Code:

This is valid XHTML
<p> This is now how you write paragraphs.. notice the closing of the tag ---></p>
<p> Now i would have two</p>
<hr /> Now i have also added a Horizontal Rule
<br /> And a page Break..
<img src="http://forums.learnwebdesign.org/styles/prosilver/imageset/site_logo.gif" alt="LWD logo" />
Now it is XHTML Valid!....
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 09-16-2009, 08:29 PM
garuav123456 garuav123456 is offline
Banned
 
Join Date: Sep 2009
Posts: 31
garuav123456 is on a distinguished road
Default Re: HTML vs XHTML: Nesting, The Difference

Thanks for sharing this Web development information. This is really a very interesting information for Web designers.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is difference between XHTML,HTML,DHTML? pradip030384 XML and SOAP 4 01-02-2009 07:56 PM
What is difference between a PHP and HTML? chocoguy PHP Programming 2 12-26-2007 04:23 AM
How many of you are using XHTML? abhilashdas Web Design Help 5 10-13-2007 02:01 PM
Difference of htm and html thangaraj83 Web Design Help 4 09-21-2007 01:12 PM
What is Nesting Actions in QTP? sundarraja Testing Tools 1 08-16-2007 06:53 AM


All times are GMT -7. The time now is 08:00 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0