XHTMLWhat is XHTML?The problem with HTMLHTML vs. XMLFrom HTML to XHTML, IFrom HTML to XHTML, IISGML and DTDsDOCTYPE declaration, IDOCTYPE declaration, IIAn XHTML ExampleToolsVocabularyThe EndJan 14, 2019XHTMLhttp://www.w3schools.com/xhtml/2What is XHTML?XHTML stands for Extensible Hypertext Markup LanguageXHTML is aimed to replace HTMLXHTML is almost identical to HTML 4.01XHTML is a stricter and cleaner version of HTMLXML (Extensible Markup Language) is a markup language designed for describing dataXHTML is HTML redefined as an XML applicationXHTML is a “bridge” between HTML and XML3The problem with HTMLHTML started out as a way of way of describing the structure of documents, with tags to indicate headers, paragraphs, and the likeBecause people wanted to control the appearance of documents, HTML acquired tags to control fonts, alignment, etc.The result is a markup language that does both, but isn’t very good at either4HTML vs. XMLXML looks a lot like HTML, but--HTML uses a fixed set of tagsWith XML you make up your own tags (and define what they mean in a separate document)HTML is designed to display data to humansXML is designed to describe data to computersBrowsers are very tolerant of errors in HTMLXML documents must be well-formed (syntactically correct)All browsers can display HTMLAll modern browsers display XML, but in various ways5From HTML to XHTML, IXHTML elements must be properly nested <b><i>bold and italic</b></i> is wrongXHTML documents must be well-formed <html><head> ... </head><body> ... </body></html>Tag names must be in lowercaseAll XHTML elements must be closedIf an HTML tag is not a container, close it like this:<br />, <hr />, <img src="smile.gif" />Note: Some older browsers require a space before the /6From HTML to XHTML, IIAttribute names must also be in lower caseExample: <table width="100%">Attribute values must be quotedExample: <table width="100%">Attribute minimization is forbiddenExample: <frame noresize="noresize">,cannot be abbreviated to <frame noresize>The id attribute replaces the name attributeWrong: <img src="picture.gif" name="picture1" />Right: <img src="picture.gif" id="picture1" />Best: <img src="picture.gif" name="picture1" id="picture1" />7SGML and DTDsSGML stands for “Standard Generalized Markup Language”HTML, XHTML, XML and many other markup languages are defined in SGMLA DTD, or “Document Type Definition” describes the syntax to use for the current documentThere are three different DTDs for XHTML--you can pick the one you wantThese DTDs are public and on the webYou must start your XHTML document with a reference to one of these DTDs8DOCTYPE declaration, IEvery XHTML document must begin with one of the DOCTYPE declarations (DTDs):<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">9DOCTYPE declaration, IIThe three main DTDs are as follows:StrictUse for really clean markup, with no display information (no font, color, or size information)Use with CSS (Cascading Style Sheets) if you want to define how the document should lookTransitionalUse with standard HTML and/or with CSSAllows deprecated HTML elementsFramesetUse if your document uses HTML frames10An XHTML Example<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html> <head> <title>A simple document</title> </head> <body> <p>A simple paragraph.</p> </body></html>11ToolsDave Raggett's HTML TIDYhttp://www.w3.org/People/Raggett/tidy/is a free UNIX tool for checking and cleaning up HTML pagesW3C HTML Validation Toolhttp://validator.w3.org/ is an HTML form for checking (but not fixing) HTML and XHTML documents12VocabularySGML: Standard Generalized Markup LanguageHTML: Hypertext Markup LanguageXHTML: eXtensible Hypertext Markup LanguageXML: eXtensible Markup LanguageDTD: Document Type Definition13The
View Full Document