- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference between HTML and XHTML
HTML and XHTML are computer languages that are used in the development of web pages. It has simpler syntax that can be understood easily. XHTML is the extension of HTML which also combines the features of XML. It has more strict syntax than HTML. Although XHTML is derived from HTML, there are considerable differences between these two.
What is HTML?
The full form of HTML is Hypertext Markup language. It was developed by Tim Berners Lee in the year 1993. It is an extended form of standard generalized markup language (SGML). HTML provides the base or skeleton for the web page development.
Hypertext is a text that links one page to another page through hyperlinks and get activated when it is clicked. A markup language is one that uses tags to design the web page and make it look more attractive. Hypertext markup language is used to develop web pages from the basic level connecting multiple pages.
All the elements in html are defined by html tags. A tag is like a keyword that helps in arranging the elements in different formats. HTML is not a programming language.
Advantages
It is simple and can be easily understood by a beginner
HTML is supported by all browsers
It can run on any operating system hence making it platform independent
It is free of cost and it is available by default in windows
It is light weighted and loads faster
Its syntax is easy to learn
It easily integrates with CSS, JavaScript and other languages
Disadvantages
It can’t produce dynamic output
Even a simple webpage requires number of lines of code
It doesn’t provide security
Even there is an error in the syntax, it runs it. But we don’t get the desired output
We can’t use only html to create a complete web page. It can only create a basic web page
What is XHTML?
XHTML stands for Extensible hypertext markup language. It was developed by World Wide Web Consortium (W3C) and released in the year 2000. It has the characteristics of both HTML and XML.
It is almost similar to that of HTML but it is a lot stricter than HTML. The main reason for the development of XHTML is that the HTML was too lenient in securing its source code. XHTML is more flexible and can be easily converted into other formats.
Every XHTML document consists of three main parts. They are −
DOCTYPE − Used to declare the type of document
Head − Used to declare title and other attributes
Body − Part that consist of the actual content that a web page contains
Advantages
It follows strict rules hence reducing errors
It makes the code readable
It provides more security and source code can’t be accessed easily
As it follows all the rules of XML, it is easy to convert to other formats
All web applications are moving towards XML. Hence it is good to use XHTML than HTML as it has more scope in future
Web pages created using this are portable. Its simplicity allows it to run on devices having small processors
Disadvantages
Beginners find it difficult to learn
Only few browsers support XHTML. Hence its practical use is limited
HTML vs XHTML
The following table highlights the major differences between HTML and XHTML −
Parameter |
HTML |
XHTML |
---|---|---|
Full form |
HTML stands for Hyper Text Markup Language |
XHTML stands for extensible hypertext markup language |
Developed by |
HTML was developed by Tim Berners Lee |
XHTML was developed by World Wide Web Consortium (W3C) |
Release date |
It was released in 1993 |
It was released in 2000 |
File format |
It is of document type file format |
It is in markup language file format |
Extended from |
HTML is extended from SGML (Standard Generalized Markup Language |
It is extended from HTML and XML (Extensible markup language) |
File extension |
It has the file extensions - .html, .htm |
It has the extensions - .xhtml, .xht, .html, .htm, .xml |
Case sensitivity |
HTML is not case sensitive. It can be written in upper case or lowercase or a combination of both |
XHTML is case sensitive. All the code should be in lower case |
DOCTYPE |
In HTML, it is not necessary to add < DOCTYPE > at the beginning of every page |
In XHTML, it is compulsory to mention < DOCTYPE > at the top of every page |
Closing tags |
In HTML, it is not mandatory to close the tags |
It is mandatory to close all the tags in XHTML |
Attributes |
While writing attributes in HTML, it is not necessary to mention them in double quotes Ex :- < color = blue > |
It is necessary to mention attribute values in quotes Ex :- <color = “blue” > |
Nesting |
It is not necessary to nest elements in order |
In XHTML, elements should be nested properly in an order |
Strictness |
HTML is lenient compared to XHTML |
XHTML strictly follows rules |
Structure of code |
Its code is less organized |
It has more organized code |
Errors |
It runs code even it consists of an error |
It strictly checks for all the errors |
Parsing |
Its source code can be accessed easily |
It is somewhat difficult to access its source code |
Security |
HTML is less secure |
XHTML provides more security |
Browser compatibility |
HTML is supported by all browsers |
Only few browsers support XHTML |
Complexity |
It has simple syntax and can be understood easily |
Beginners find it difficult to understand |
Conclusion
The main goal of both HTML and XHTML is the creation of web pages. XHTML is an extended version of HTML and it follows more rules and a lot stricter compared to that of HTML. XHTML can be easily converted into other data formats.