XHTML And HTML - What Are The Differences?
In my last post I listed ten technologies I think every web designer should know. In this post I am going to describe some of the differences between the previous standard, HTML, and the new standard, XHTML. First, the good news: if you are currently using HTML 4.01 to design your web pages, it will be very easy for you to convert to XHTML 1.0.
XHTML is based on XML (eXtensible Mark-up Langguage). To the browser it behaves exactly HTML. The major differences between HTML and XHTML 1.0 are the tighter rules required by the latter. Let's discuss what they are. The most important differences, according to www.w3schools.com are:
Please ignore the ' inside each XHTML tag. I added them because when you write a blog you are writing HTML. If I had not inserted an extra character inside each tag, the browser would have assumed I was trying to write HTML code and given me error messages. When I type <'HTML>, ignore the left apostrophe.
1. XHTML elements must be properly nested. (Example: <'h2><'b>This Heading is bold<'/b><'/h2>).
2. XHTML elements must always be closed. (Example: In HTML this tag does not have to be closed, i.e., <'p> with no closing <'/p> tag is acceptable. XHTML requires both <'p> and <'/p>.
3. XHTML elements must always be in lowercase. In HTML all these element tags are correct: <'HTML>, <'Html>, <'html>. XHTML always requires <'html>.
4. XHTML documents must have one root element. In other words, all XHTMl elements must be nested within the <'html> root element.
5. In XHTML attribute names must be in lower case and must be in quotes. (Example: <'table width="760">) This is incorrect: <'TABLE WIDTH=760>.
6. Atttibute minimization is forbidden. (Example: This is wrong: <'input checked>. This is correct: <'input checked="checked" />.
7. The id attribute replaces the name attribute. (Example: This is wrong: <'img src="frodo.jpg" name="frodo1" />. This is correct <'img src="frodo.jpg" id="frodo1" />.
8. All XHTML documents must have a DOCTYPE declaration. The minimum XTHML document template:
<'html xmllns="http://www.w3.org/1999/xhtml">
<'head>
<'title>Differences Between HTML and XHTML<'/title>
<'/head>
<'body>
Content goes here.
<'body>
<'/html>
NOTE: The World Wide Web Consortium requires that DOCTYPE be typed in all caps. IT is not part of the XHTML document itself and is always placed before the opening <'html> tag.
Most web designers are using XHTML 1.0 Transitional because it is more compatible with HTML and with current web browsers. It is much easier to convert HTML to XHTML 1.0 Transitional than to XHTM 1.1 Strict. The W3W has been working on XHTMl 2.0 for several years, but it is not ready for release.
XHTML is based on XML (eXtensible Mark-up Langguage). To the browser it behaves exactly HTML. The major differences between HTML and XHTML 1.0 are the tighter rules required by the latter. Let's discuss what they are. The most important differences, according to www.w3schools.com are:
Please ignore the ' inside each XHTML tag. I added them because when you write a blog you are writing HTML. If I had not inserted an extra character inside each tag, the browser would have assumed I was trying to write HTML code and given me error messages. When I type <'HTML>, ignore the left apostrophe.
1. XHTML elements must be properly nested. (Example: <'h2><'b>This Heading is bold<'/b><'/h2>).
2. XHTML elements must always be closed. (Example: In HTML this tag does not have to be closed, i.e., <'p> with no closing <'/p> tag is acceptable. XHTML requires both <'p> and <'/p>.
3. XHTML elements must always be in lowercase. In HTML all these element tags are correct: <'HTML>, <'Html>, <'html>. XHTML always requires <'html>.
4. XHTML documents must have one root element. In other words, all XHTMl elements must be nested within the <'html> root element.
5. In XHTML attribute names must be in lower case and must be in quotes. (Example: <'table width="760">) This is incorrect: <'TABLE WIDTH=760>.
6. Atttibute minimization is forbidden. (Example: This is wrong: <'input checked>. This is correct: <'input checked="checked" />.
7. The id attribute replaces the name attribute. (Example: This is wrong: <'img src="frodo.jpg" name="frodo1" />. This is correct <'img src="frodo.jpg" id="frodo1" />.
8. All XHTML documents must have a DOCTYPE declaration. The minimum XTHML document template:
<'html xmllns="http://www.w3.org/1999/xhtml">
<'head>
<'title>Differences Between HTML and XHTML<'/title>
<'/head>
<'body>
Content goes here.
<'body>
<'/html>
NOTE: The World Wide Web Consortium requires that DOCTYPE be typed in all caps. IT is not part of the XHTML document itself and is always placed before the opening <'html> tag.
Most web designers are using XHTML 1.0 Transitional because it is more compatible with HTML and with current web browsers. It is much easier to convert HTML to XHTML 1.0 Transitional than to XHTM 1.1 Strict. The W3W has been working on XHTMl 2.0 for several years, but it is not ready for release.
0 Comments:
Post a Comment
<< Home