XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

22
XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell

Transcript of XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

Page 1: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

XHTML Basics

I450 Technology SeminarCopyright 2003, Matt Hottell

Page 2: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

HTML

Developed in 1991 by Tim Berners-Lee in Switzerland for CERN

Page 3: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

HTML

Developed in 1991 by Tim Berners-Lee in Switzerland for CERN

Originally designed for marking up and displaying scientific text

Page 4: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

HTML Issues

Browser war bloating

Page 5: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

HTML Issues

Browser war bloating

Does not separate visual markup from logical markup

Page 6: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

Logical markup

Markup that explains what the tagged data is or what role it plays in the document

Page 7: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

Logical markup

Markup that explains what the tagged data is or what role it plays in the document

<h1> <title> <table> <blockquote>

Page 8: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

Visual markup

Markup that only determines how the tagged data is to be displayed

Page 9: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

Visual markup

Markup that only determines how the tagged data is to be displayed

<em> <b> <font> <center>

Page 10: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

HTML<HTML><head><title>My Page</title><BODY><p><b><em>My favorite foods:</b></em><ul><li>Pizza<li>Ice Cream<li>Tortas</li></ul><p><table><tr><td>My pictures:<td><img src=“mypic.jpg” height=200 width=200></table></html>

Page 11: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

Why XHTML?

Separates logical from visual markup Move all visual markup into a separate

style sheet Follows XML standards Is backwards-compatible with HTML Compatible with new types of displays

Cell phones, kiosks, PDAs, etc.

Page 12: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

XHTML Basics

XHTML can be seen as a subset of logical HTML elements.

3 different XHTML subsets: Frameset, transitional, strict

Page 13: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

XHTML Basics

Must follow XML rules:

Must be “well-formed” or syntactically correct according to a document standard

For XHTML, this document standard is the World Wide Web Consortium XHTML standard which can be found at http://www.w3.org/TR/xhtml1/

Page 14: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

XHTML Basics

Must follow XML rules: All elements must be properly nestedBad:<span><a href=‘mypage’>HI!</span></a>Good:<span><a href=‘mypage’>HI!</a></span> Some elements can contain other

elements, others cannot.

Page 15: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

XHTML Basics

Must follow XML rules: All tags must be properly terminatedBad:<ul><li>One<li>Two<li>Three</ul>Good:<ul><li>One</li><li>Two</li><li>Three</li></ul>

<br> becomes <br />

Page 16: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

XHTML Basics

Must follow XML rules: All tags must be lower-case

Page 17: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

XHTML Basics

White space: Do not leave trailing spaces Separate attributes by one space

Bad:<table class=‘picframe’width=‘100’ ></table

>Good:<table class=‘picframe’ width=‘100’></table>

Page 18: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

XHTML Basics Attributes

Must be enclosed in quotes<img src=“mypicture.jpg” height=‘100’ />

Name attribute replaced by id<table name=‘pictable’ id=‘pictable’ >

No standalone attributes<option checked=“checked” />

Images require alt attributes.<img src=‘mypic.jpg’ alt=‘Me!’ />

Page 19: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

XHTML Basics

Must validate against a document model that is declared at the beginning of the XHTML document

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

Page 20: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

XHTML Skeleton<!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"><head><meta http-equiv="Content-Type" content="text/html;

charset=utf-8" /><title>Untitled Document</title></head><body></body></html>

Page 21: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

HTML<HTML><head><title>My Page</title><BODY><p><b><em>My favorite foods:</b></em><ul><li>Pizza<li>Ice Cream<li>Tortas</li></ul><p><table><tr><td>My pictures:<td><img src=“mypic.jpg” height=200 width=200></table></html>

Page 22: XHTML Basics I450 Technology Seminar Copyright 2003, Matt Hottell.

XHTML Conversion<!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"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title></head><body><p><b><em>My favorite foods:</em></b><ul><li>Pizza</li><li>Ice Cream</li><li>Tortas</li></ul></p><p><table><tr><td>My pictures:</td><td><img src=“mypic.jpg” height=‘200’ width=‘200’ alt=‘My

Picture!’ /></td></tr></table></p></body></html>