Wednesday, July 15, 2009

How is HTML and XHTML related and different? What implications does XHTML have on web development?

XHTML and HTML are related because they are both markup languages, which means they use elements -- such as %26lt;h1%26gt; or %26lt;p%26gt; or %26lt;div%26gt; -- to describe information in a document, so a Web browser can read them and interpret them.





They are different in the XHTML is modularized, while HTML is not. W3C's HTML specifications contain specific elements (tags) that are defined by W3C and have specific attributes.





XHTML instead groups display elements into modules, such as the table module, the text module, etc. Each module contains certain elements.





The reason for modularization in XHTML is to make it even more extensible than HTML. Since HTML has a fixed number of elements, it can only render those elements, and only in ways that comply with the HTML specification.





Because XHTML is modularized, you can create new modules as new technologies become available, and add new elements to those modules, meaning there's no theoretical limit to what XHTML can describe -- the same way there's no theoretical limit to what XML can describe.





And that means there's no theoretical limit to what a Web browser can do, so long as it understands an XHTML module being used by a site; eventually, XHTML will be able to tell Web browsers what a module does and how to render its elements, the same way XSLT can tell a Web browser what an XML document means and how to render it.





There are also technical differences in how you write HTML and XML, noticably in the use of attributes and closing tags. Certain XHTML elements require certain attributes (such as the %26lt;img%26gt; tag, which requires the src and alt attributes), and all XHTML tags must be closed, while certain HTML tags don't need to be closed (such as the %26lt;br%26gt; tag).





You can learn more about both by visiting http://www.w3.org.


No comments:

Post a Comment