Back to Syllabus

Here Come the Acronymns... HTML, XHTML, XML, and CSS .


What is XHTML?

  • XHTML stands for EXtensible HyperText Markup Language XHTML is aimed to replace HTML
  • XHTML is almost identical to HTML 4.01
  • XHTML is a stricter and cleaner version of HTML
  • XHTML is HTML defined as an XML application
  • XHTML 1.0 became an official W3C Recommendation January 26, 2000.
  • XHTML is a combination of HTML and XML (eXtensible Markup Language).
  • XHTML consists of all the elements in HTML 4.01 combined with the syntax of XML.

Why XHTML?

  • We have reached a point where many pages on the WWW contain "bad" HTML
  • Today's market consists of different browser technologies, some browsers run internet on computers, and some browsers run internet on mobile phones and palm pilots. The last-mentioned do not have the resources or power to interpret a "bad" markup language.
  • Therefore - by combining HTML and XML, and their strengths, we got a markup language that is useful now and in the future - XHTML.

What is XML

  • XML stands for EXtensible Markup Language. XML is a markup language much like HTML.
  • XML was designed to describe data. Whereas HTML was designed to display data.

Mandatory XHTML Elements

  • All XHTML documents must have a DOCTYPE declaration.
  • The html, head and body elements must be present, and the title must be present inside the head element. This is a minimum XHTML document template:
<!DOCTYPE Doctype goes here>
<html>
<head>
<title>Title goes here</title>
</head>
<body>
Body text goes here
</body>
</html>

The 3 Document Type Definitions

  • DTD specifies the syntax of a web page in SGML.
  • DTD is used by SGML applications, such as HTML, to specify rules that apply to the markup of documents of a particular type, including a set of element and entity declarations.
  • XHTML is specified in an SGML document type definition or 'DTD'.
  • An XHTML DTD describes in precise, computer-readable language the allowed syntax and grammar of XHTML markup.

There are currently 3 XHTML document types:

  • STRICT
  • TRANSITIONAL
  • FRAMESET

XHTML 1.0 specifies three XML document types that correspond to three DTDs: Strict, Transitional, and Frameset.

XHTML 1.0 Strict

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Use this when you want really clean markup, free of presentational clutter. Use this together with Cascading Style Sheets.

XHTML 1.0 Transitional

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Use this when you need to take advantage of HTML's presentational features and when you want to support browsers that don't understand Cascading Style Sheets.

XHTML 1.0 Frameset

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

Use this when you want to use HTML Frames to partition the browser window into two or more frames.

What is CSS?

  • CSS stands for Cascading Style Sheets
  • Styles define how to display HTML elements
  • Styles are normally stored in Style Sheets
  • Styles were added to HTML 4.0 to solve a problem
  • External Style Sheets can save you a lot of work
  • External Style Sheets are stored in CSS files

CSS Solve a Common Problem

  • HTML tags were originally designed to define the content of a document
  • The layout of the document was supposed to be taken care of by the browser, without using any formatting tags. The content of HTML documents was supposed to be clearly separated from the document's presentation layout.
  • By combining CSS with strict HTML rules, you CAN build a site that uses HTML for content and lets your CSS define style.