Homepage › Forums › Articles › Programming › Markup Languages and Style-sheets › Quick HTML and XHTML Comparison
This topic was published by DevynCJohnson and viewed 1508 times since "". The last page revision was "".
Viewing 1 post (of 1 total)
- AuthorPosts
Differences
- HTML5 is a revision of HTML4
- XHTML is a bridge between HTML and XML
- XHTML5 is an XML adaptation of the HTML5 specification
- Most browsers support HTML, but they may not support XHTML
- XHTML and HTML5 have different methods for presenting data
- HTML4 is SGML-based while XHTML is XML-based
- HTML uses the file extensions *.html and *.htm
- XHTML uses the file extensions *.html, *.htm, *.xht, *.xhtml, and *.xml
- HTML uses the "text/html" mimetype while XHTML uses "application/xhtml+xml"
- HTML5 is less strict on its coding requirements unlike XHTML
- The DOCTYPE is mandatory in XHTML
- TheĀ "
<html>
" tag requires the xmlns attribute in XHTML, but not HTML - XHTML must have the following tags -
<html>, <head>, <title>, and <body>
- All XHTML tags must be closed, but that is not necessarily true in HTML
- XHTML has restrictions on tag-nesting while HTML5 is not as strict on nesting
- XHTML documents must have one root element
- XHTML forbids attribute minimization, but not HTML
- HTML tags are case-insensitive
- XHTML tags and attributes must all be lowercase and attributes must be quoted
Abbreviations
- DHTML - Dynamic HyperText Markup Language
- HTML - HyperText Markup Language
- SGML - Standard Generalized Markup Language
- XHTML - eXtensible HyperText Markup Language
- XML - eXtensible HyperText Markup Language
NOTE: DHTML is not its own language. Rather, "DHTML" refers to the use of HTML, JavaScript, DOM, and CSS.
XHTML 1.0 Code
<!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"> <head> <title>XHTML Sample</title> </head> <body> <p>Text</p> </body> </html>
HTML5 Code
<!DOCTYPE html> <html> <head> <title>Sample Document</title> </head> <body> <p>Very Basic HTML5 Template</p> <p>See https://dcjtech.info/topic/html5-template/ for a more advanced template.</p> </body> </html>
XHTML5 Code
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Sample XHTML5 Document</title> <meta charset="UTF-8" /> </head> <body> <p>Very Basic XHTML5 Template</p> </body> </html>
Further Reading
- HTML5 Template - https://dcjtech.info/topic/html5-template/
- AuthorPosts
Viewing 1 post (of 1 total)