Sep 10, 2011
admin
Comments Off

HTML and XHTML in Webpage Creation

In the family of markup languages, HTML offers a flexible framework using which webpages can be easily created. eXtensible HyperText Markup Language (XHTML) is an extension to HTML, a more restrictive subset of markup languages. XHTML needs to be well-written following every rule strictly. HTML and XHTML in syntax are not that different.

A simple example of an XHTML code is the code of the Google search page which is shown below:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://

www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<html lang=”en” dir=”ltr” xmlns=”http://www.w3.org/1999/xhtml”>

<head>

<meta http-equiv=”content-type” content=”text/html; charset=UTF-8″>

<title>Google</title>

</head>

<body>…….</body>

</html>

The three major parts of a XHTML code are its DOCTYPE declaration, the head part and the body part. The first part is the DOCTYPE which is the Document type declaration. This description specifies the version of the markup language in which the webpage is written and this is meant for the browser to display the information properly. Various versions are XHTML 1.0 strict, XHTML 1.0 transitional, XHTML 1.0 frameset and XHTML 1.1.

By strict sense of XHTML, it means that there are some rules in XHTML which must be followed. HTML and XHTML both contain elements which are the most important components of any webpage design. The first rule is for the elements to be closed necessarily. In HTML, opening tags of elements are mandatory, but closing tags are optional. But in XHTML, they should be present. The closing tags should be written in the reverse order as they were opened. Tags opened first should be closed last and vice versa.

One of the other rules to be followed is the use of lowercase letters for all the tags. Writing a code in this language also requires closing empty tags as well.

 

Comments are closed.