XHTML - Extensible version of HTML

Introduction:

Although many people have never heard of it, XHTML is really the future of the internet. It is the newest generation of HTML (comming after HTML 4) but has many new features which mean that it is, in some ways, like XML. In this tutorial I will explain how XHTML differs from HTML and how you can update your pages to support it.
Note: It is necessary to already have a basic understanding of HTML before reading this tutorial as it deals with the differences between XHTML and HTML.


What is XHTML


XHTML stands for eXtensable HyperText Markup Language and is a cross between HTML and XML. XHTML was created for two main reasons:


  1. To create a stricter standard for making web pages, reducing incompatibilities between browsers

  2. To create a standard that can be used on a variety of different devices without changes.
An XHTML document is made up of four main components:
  • Document Type Definition (DTD): This used to be optional in HTML, but it is compulsory in XHTML. The DTD describes the language or script in which the text has been encoded.
  • Text content: the headers and paragraphs that appear on the page.
  • References: Advanced content like links and images.
  • Mark-Up: Instructions on how the content should be displayed.
Each of these components is comprised of text. This means that the page can be saved in text format and viewed in any browser.
XHTML stands for extensible Hypertext Markup Language. It is a different version of HTML, it is based off of XML. XHTML is used to make webpages and has a very specific way to be written to be correct and without error. XHTML is also very case-sensitive. the tags are written in lowercase and need to be closed.The order of the tags also need to be in correct order for the information to come out correct. there are three main sections of XHTML consist of A declaration statement, a Head statement and a body.

XML Declaration

It is a good idea to begin all XHTML, or indeed any XML application, with an XML declaration. XML declarations explicitly state which version of XML and which character encoding we are going to use. For example, if we wanted to use XML 1.0 with Western European character encoding, our XML declaration might look something like this:
<?xml version="1.0" encoding="iso-8859-1"?>

Doctype Declaration[edit]

Your XHTML isn't valid unless it has a doctype. Doctypes are actually SGML statements which tell the browser what version of XHTML you are using. For example, to let the UA know that we want our markup to be served as XHTML 1.0 Strict, we need only input the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"?>
This is the sample web page created using XHTML:
<?xml version="1.0" encoding="iso-8859-1"?>
 <!DOCTYPE html 
   PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
   <head>
     <title>
       XHTML- WEB LANGUAGE
     </title>
   </head>
   <body>
     <p>
       WebDevelopment Knowledge is our need.
     </p>
   </body>
 </html>
The first line is the doctype. This tells the browser what type of document the file is. All valid HTML and XHTML documents have a doctype. We will be using the XHTML 1.0 Strict doctype.

No comments:

Post a Comment