Let's look at the original HTML version compared with the new XHTML version.
<HTML>
<BODY>
<h1>My First Webpage</h1>
Hi everyone, how do you like my page?
</BODY>
</HTML>
<BODY>
<h1>My First Webpage</h1>
Hi everyone, how do you like my page?
</BODY>
</HTML>
Original HTML listing
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>My First Webpage</h1>
Hi everyone, how do you like my page?
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>My First Webpage</h1>
Hi everyone, how do you like my page?
</body>
</html>
New XHTML listing
NOTE:
HTML and XHTML don’t care about so-called “white space”. White space includes spaces, tabs, new lines, etc. In other words, your page would still function and look the same in the browser if you wrote the whole page on one line, or if you used no indentation. This is a bad idea however. Use your own coding and indentation style or copy the one used here, just do it consistently and in a way that is easy to read. This is especially important if you work in a team!As you can see, there aren't many differences. Just get used to adding a bit more at the top of each page and writing all tags in lower case. A few other rules exist as well, and the most important of all is that every tag must be 'closed'. This means that if you have a <p> tag, you need to close it with a </p> tag. This wasn't the case in HTML, you could write various tags without closing them. XHTML is making us play by the rules and helping us be ready for the future.
