XHTML

15
Introduction

description

Introduction. XHTML. Document Structure Overview. XML declaration (prolog) Document type declaration Root element (namespace) Document header Document body. Document Structure.

Transcript of XHTML

Page 1: XHTML

Introduction

Page 2: XHTML

Document Structure Overview XML declaration (prolog) Document type declaration Root element (namespace) Document header Document body

Page 3: XHTML

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>

Page 4: XHTML

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>

Page 5: XHTML

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>

Page 6: XHTML

DOCTYPE and Namespace Tell browsers how to interpret document Tell validations services how to test for

conformance

Page 7: XHTML

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:TransitionalStrictFrameset

Page 8: XHTML

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”>

Page 9: XHTML

XHTML1 Transitional

Closest to HTML Can work with

Presentational markup structuresDeprecated elementsDeprecated attributes

Used for converting existing web sites

Page 10: XHTML

XHTML1 Frameset

Used for documents that contain a <frameset> element

Same elements as Transitional plusFramesetFramenoframe

Page 11: XHTML

XHTML1 Strict

Excludes all deprecated elements and attributes

New web site development What we use in class

Page 12: XHTML

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 StrictNew developmentUse of style sheets

XHTML 1.1Currently lack of browser support

XHMTL 2.0Under development

use in class

Page 13: XHTML

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”>

Version of XML = english Document in english

Page 14: XHTML

Document Header Information about the document that is not

considered part of the document contentInfo for usersInfo for browsersInfo for search engines

Must include title Displayed in the top bar of the browserBookmark or favorites listKey tool for accessibility Search engines

Page 15: XHTML

Document Body

<body>…</body> Required element Contains all elements of normal

document flow