Docsity

XHTML: The Stricter and Cleaner Version of HTML, Slides of Computer Science

Partial preview of the text

Download XHTML: The Stricter and Cleaner Version of HTML and more Slides Computer Science in PDF only on Docsity!

XHTML

What is XHTML?

  • XHTML stands for Extensible Hypertext Markup Language - XHTML is aimed to replace HTML - XHTML is almost identical to HTML 4. - XHTML is a stricter and cleaner version of HTML
  • XML (Extensible Markup Language) is a markup language designed for describing data - XHTML is HTML redefined as an XML application - XHTML is a “bridge” between HTML and XML

HTML vs. XML

XML looks a lot like HTML, but--

HTML uses a fixed set of tags

With XML you make up your own tags (and define what they mean in a separate document) HTML is designed to display data to humans

XML is designed to describe data to computers Browsers are very tolerant of errors in HTML

XML documents must be well- formed (syntactically correct) All browsers can display HTML

Most modern browsers can display XML Docsity.com

From HTML to XHTML, I

  • XHTML elements must be properly nested bold and italic is wrong

  • XHTML documents must be well-formed

    ... ...

  • Tag names must be in lowercase

  • All XHTML elements must be closed

    • If an HTML tag is not a container, close it like this:
      , ,
    • Note: Some browsers require a space before the /

SGML and DTDs

  • SGML stands for “Standard Generalized Markup Language”
  • HTML, XHTML, XML and many other markup languages are defined in SGML
  • A DTD, or “Document Type Definition” describes the syntax to use for the current document
  • There are three different DTDs for XHTML--you can pick the one you want - These DTDs are public and on the web - You must start your XHTML document with a reference to one of these DTDs

DOCTYPE declaration, I

  • Every XHTML document must begin with one of the DOCTYPE declarations (DTDs): - - -

An XHTML Example

  •  A simple document <p>A simple paragraph.</p> 

Tools

  • Dave Raggett's HTML TIDY

is a free UNIX tool for checking and cleaning up HTML pages

  • W3C HTML Validation Tool is an HTML form for checking (but not fixing) HTML and XHTML documents

The End