160 likes | 361 Views
Introduction. XHTML. Document Structure Overview. XML declaration (prolog) Document type declaration Root element (namespace) Document header Document body. Document Structure. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
E N D
Introduction XHTML
Document Structure Overview • XML declaration (prolog) • Document type declaration • Root element (namespace) • Document header • Document body
Document Structure <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Document Title</title> </head> <body> <p>Content of document...</p> </body> </html>
XML Prolog • Optional • Specifies XML version • Declares type of character encoding • <?xml version=“1.0” encoding=“ISO-8859-1”?> • Problem: IE/Windows browser can not interpret prolog site not displayed correctly • Solution: specify character encoding in <head> <head><meta http-equiv="content-type" content="text/html; charset=utf-8" /></head>
Document Structure (for IE) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Document Title</title> </head> <body> <p>Content of document...</p> </body> </html>
DOCTYPE and Namespace • Tell browsers how to interpret document • Tell validations services how to test for conformance
DOCTYPE • Allows designers/developers to author several different types of documents, each bound by different rules • Rules: XHTML 1.0 specifications, called document type definition (DTD) • XHTML 1.0 offers 3 DTDs: • Transitional • Strict • Frameset
DOCTYPE declaration • Top of every XHTML document, before any code or markup • After XML prolog • <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
XHTML1 Transitional • Closest to HTML • Can work with • Presentational markup structures • Deprecated elements • Deprecated attributes • Used for converting existing web sites
XHTML1 Frameset • Used for documents that contain a <frameset> element • Same elements as Transitional plus • Frameset • Frame • noframe
XHTML1 Strict • Excludes all deprecated elements and attributes • New web site development • What we use in class
Which Standard? • XHTML 1.0 Transitional • Conversion of existing HTML 4.01 sites • XHTML 1.0 Frames • Conversion of existing HTML 4.01 sites that contain frames • XHTML 1.0 Strict • New development • Use of style sheets • XHTML 1.1 • Currently lack of browser support • XHMTL 2.0 • Under development use in class
Root Element (XML NameSpace) • Collection of XML element types and attribute names associated with a specific DTD • <html xmlns=http://www.w3.org/1999/xhtml xml:lang=“en” lang=“en”> Document in english Version of XML = english
Document Header • Information about the document that is not considered part of the document content • Info for users • Info for browsers • Info for search engines • Must include title • Displayed in the top bar of the browser • Bookmark or favorites list • Key tool for accessibility • Search engines
Document Body • <body>…</body> • Required element • Contains all elements of normal document flow