XHTML - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

XHTML DOCTYPE

XHTML DOCTYPE

shape Introduction

This chapter demonstrates about the XHTML DOCTYPE which defines a syntax of the web page in SGML and following are the concepts are covered in this chapter.
  • About DOCTYPE
  • Three DTDs

About DOCTYPE

shape Description

Any XHTML Document <DOCTYPE>is a mandatory field which is present at the starting of the coding part user can declare the doctype in upper case or lower case letters  and XHTML document consist mainly three parts are shown below.
  • DOCTYPE Declaration
  • <head> section
  • <body> section
The snippet below demonstrates the basic document structure as shown. [html] <!DOCTYPE ...> <html> <head> <title>... </title> </head> <body> ... </body> </html> [/html] The code below demonstrates the simple XHTML Document as shown. [html] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>simple document</title> </head> <body> <p>a simple paragraph</p> </body> </html> [/html] Result By running the above code in a preferred browser user can get the following output as shown in below image.

Three DTDs

shape Description

XHTML Doctype defines the syntax of the webpage in SGML which are used by SGML applications to define some rules for a document to a particular type which includes some elements and entity declarations. XHTML DOCTYPE precise computer readable language which allows XHTML markup syntax. There are three types XHTML DTDs are available which are shown below. STRICT By using STRICT user can use the Cascading Style Sheets and avoid writing of XHTML attributes in order to use the STRICT DTD user need include the one line snippet at the starting of XHTML Documnet which is shown below. [html] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> [/html] TRANSITIONAL By using TRANSITIONAL DTD user can several Cascading Style Sheets along with XHTML attributes which can be done by adding single line snippet to the XHTML DOcument which is shown below. [html] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> [/html] FRAMESET By using FRAMESET DTD user can use the HTML Frames to partition the browser window which can be done by adding the single snippet at the top of the XHTML Document which is shown below. [html] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> [/html]

Summary

shape Key Points

  • User can partition the browser window by using Frameset.
  • Doctype defines the syntax of the webpage in SGML.
  • Doctype  should be present at the top of the document.