Open In App

Difference between HTML XHTML & DHTML

Last Updated : 11 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

When it comes to web development, understanding the nuances of different markup languages is essential. In this article, we will understand the distinctions between HTMLXHTML, and DHTML—three cornerstones of the web.

What is HTML?

HTML is a short form of Hyper Text Markup Language. It is a language that is used in creating web apps and websites. HTML is known as a markup language that helps in creating web applications so it is a markup language. The main purpose of HTML is to create web pages or websites which are static. It can only be used in front-end development means it is not used for back-end functionalities like sending or receiving data. HTML links are used to connect one web page to another.

Syntax:

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>HTML Syntax</title>
</head>
 
<body>
    <h2>GFG is best.</h2>
    <hr>
    <p><b>Learn anything from GFG
</body>
 
</html>


What is XHTML?

XHTML is a short form of Extensible Hyper Text Markup Language. This can be considered as a combined language that uses features from both HTML and XML. All the tags and properties of HTML are inherited in XHTML and it is a bit strict when comes to opening and closing of tags, case sensitivity, and also error finding. It is a good language but it is not very flexible so developers did not show much interest in this language so it is not used as much as HTML for making web pages and websites.

Syntax:

HTML




<!DOCTYPE html>
<html xmlns="XML namespace">
 
<head>
    <title>XHTML Syntax</title>
</head>
 
<body>
    <hr />
    <h2>GFG is best</h2>
    <p>Learn anything from GFG</p>
    <p></p>
</body>
 
</html>


In XHTML you can notice that paragraph tag <p> is closed because without that XHTML will give error but in case of HTML there is no need to close the tag.

What is DHTML?

DHTML is a short form of Dynamic Hyper Text Markup Language. This language was created with the purpose of providing interactivity to the web pages as HTML was only capable of creating static web pages. Users like interactive web pages more than normal web pages, on interactive web pages several features are programmed like changing of style on clicking or hovering. DHTML also make it possible to return a response to the user’s input without the involvement of any web server.

Syntax:

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>DHTML Syntax</title>
</head>
 
<body>
    <hr />
    <h2>GFG is best</h2>
    <br />
    <script type="text/javascript">
        document.write("Learn anything from GFG");
    </script>
</body>
 
</html>


Difference Between HTML, XHTML and DHTML

  HTML XHTML DHTML
1. HTML is applied in constructing web pages. XHTML is advance version of HTML whose foundation is XML. DHTML is a mixture of various technologies applied in web development.
2. HTML is elementary and straightforward development language. XHTML is stricter than HTML as it is case sensitive and syntax must be correct. DHTML uses various languages like HTML, CSS, JS and DOM for producing web pages.
3. At time of presenting data simple errors are ignored. It provide error handling functionalities and data format have to be correct. It is mainly used to create highly interactive web pages along with animation. 
4. Functionality of writing scripts at server side is not provided in HTML. XHTML also does not have server side scripting feature. DHTML is capable of writing scripts which can be run on server side.
5. HTML files are saved with .htm or .html file extension. XHTML files are saved with .xhtml file extension. DHTML files are saved with .dhtml file extension.
6. Fetching data from database using only HTML is not possible. Connectivity to database is not available in XHTML.  Connectivity to database is available in DHTML which let it interact with database.
7. It is not sensitive about nesting of elements. Nesting of elements must be done in proper manner. DHTML also ignores the nesting structure of elements.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads