I had written about the differences between HTML and XML in last years Blogchatter’s A2Z ‘X’ post…this year, I am writing about a similar topic – XHTML. HTML is ‘Hyper Text Markup language’ and is mostly used to format and present data to the audience. It is a forgiving markup language. Even if you make errors while writing it, it does not complain too much and continues to give the results albeit in a different manner.
XHTML though is slightly different. Here are a few details about XHTML:
XHTML:
XHTML was developed by W3C or World Wide Web Consortium to help with the transition from HTML to XML.
XHTML or ‘Extensible Hypertext Markup language’ is not as liberal as HTML.
It is more strict with its its tags.
If you already know HTML, then, learning XHTML will be a breeze.
All the elements written in XHTML must be in lowercase
The elements must be closed and properly nested
The <!DOCTYPE> is mandatory
The xmlns attribute in <html> is mandatory as well
<html>, <head>, <title>, and <body> are all mandatory
This is a sample XHTML code:
<?xml version=”1.0″ encoding=”UTF-8″?> <!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/TR/xhtml1″ xml:lang=”en” lang=”en”>
<head>
<title>BlogchatterA2Z </title>
</head>
<body> Today is ‘Y’ post….
</body>
</html>
As we can see all the tags are closed properly and the code is written in lower case.
This post is for alphabet ‘X’ for #BlogchatterA2Z #2021 by @Blogchatter
Ok i frankly did not understand much as i am technically really bad. Whatever little i have learnt has been by reading your blogs. I’ll pass this post to my son. They are studying html in school these days
Deepika Sharma
Thanks Deepika…