Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World...

53
Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg

Transcript of Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World...

Page 1: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML1

Chapter 4

Introduction to XHTML: Part 1

Reference From:

Internet & World Wide Web: How to ProgramDeitel, Deitel & Goldburg

Page 2: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML2

What is XHTML?

EXXtensible HHyperTText MMarkup LLanguage– XHTML 1.1– A markup language that specifies the format of

the text that is displayed in a Web browser.– Separation of the presentationpresentation of a document

from the structurestructure of the document’s information– Based on HTML

A legacy technology of the World Wide Web Consortium (W3C)

Page 3: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML3

Editing XHTML

XHTML documents– Source-code form– Text editor (e.g. Notepad, emacs, etc.)– .html or .htm file-name extension– Web server

Stores XHTML documents

– Web browser Requests XHTML documents

Page 4: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

XHTML DTD

The XHTML standard defines three Document Type Definitions. The most common is the XHTML Transitional.

An XHTML document consists of three main parts:

1. the DOCTYPE 2. the Head 3. the Body

Introduction to XHTML4

Page 5: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

XHTML document types

There are currently 3 XHTML document

types: STRICT TRANSITIONAL FRAMESET

Introduction to XHTML5

Page 6: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

XHTML 1.0 Strict

<!DOCTYPE html

PUBLIC "-//W3C//DTD XHTML 1.0

Strict//EN" “http://www.w3.org/TR/xhtml1/DTD/

xhtml1-strict.dtd">

Use this when you want really clean markup, free of

presentational clutter. Use this together with CSS.

Introduction to XHTML6

Page 7: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

XHTML 1.0 Transitional

<!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN’’ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Use this when you need to take advantage of HTML's presentational features and when you want to support browsers that don't understandCascading Style Sheets.

Introduction to XHTML7

Page 8: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

XHTML 1.0 Frameset

<!DOCTYPE htmlPUBLIC "-//W3C//DTD

XHTML 1.0 Frameset//EN“ "http://www.w3.org/TR/xhtml1/

DTD/xhtml1-frameset.dtd">

Use this when you want to use HTML Frames to

partition the browser window into two or more

frames.Introduction to XHTML8

Page 9: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML9

First XHTML Example (1)

XHTML comments starts with <!-- and end with -->

Mandatory XHTML Elements: <?xml version =“1.0”?> <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”> <!–- this is an example page --> <html >

<head> <title>Title goes here</title>

</head> <body> </body></html>

Page 10: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML10

First XHTML Example (2)

html element is the root element of a XHTML document– head element– The <head> element is a container for all the head elements. Elements inside <head> can include scripts, instruct the browser where to find style sheets, provide meta information, and more.

– The following tags can be added to the head section: <title>, <style>, <meta>, <link>, <script>, <noscript>, and <base>.

– body element Body section: Page’s content the browser displays

Page 11: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML11

First XHTML Example (3)

body element Body section: Page’s content the browser displays

– The <body> tag defines the document's body.– The <body> element contains all the contents of

an HTML document, such as text, hyperlinks, images, tables, lists, etc.

Page 12: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML12

First XHTML Example (4)

Every element starts with Start tag and ends with End tag, with the displayed content in between them.

Example: <html>. . .</html>, <head>. . .</head>. Start tag may have attributes (provide additional

information about an element)– A name and value pair– Example:

<html xmlns=“http://www.w3.org/1999/xhtml”>

Page 13: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML13

XHTML Syntax Rules

XHTML documents must have one root element XHTML elements

– be properly nested – be closed – be in lowercase

Attribute names– be in lower case

Attribute values– be quoted

Page 14: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

<title> Element / Tag

The HTML <title> Element– The <title> tag defines the title of the document.– The <title> element is required in all HTML/XHTML documents.

The <title> element:– defines a title in the browser toolbar– provides a title for the page when it is added to favorites– displays a title for the page in search-engine results

A simplified HTML document:<html>

<head><title>Title of the document</title></head><body>The content of the document......</body></html>

Introduction to XHTML14

Page 15: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML15

main.html(1 of 1)

1 <?xml version = "1.0"?>

2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"

3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

4

5 <!-- Fig. 4.1: main.html -->

6 <!-- Our first Web page -->

7

8 <html xmlns = "http://www.w3.org/1999/xhtml">

9 <head>

10 <title>Internet and WWW How to Program - Welcome</title>

11 </head>

12

13 <body>

14 <p>Welcome to XHTML!</p>

15 </body>

16 </html>

Page 16: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML16

Headers

Six headers ( header elements): h1 ~ h61 <?xml version = "1.0"?>

2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"

3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

4

5 <!-- Fig. 4.4: header.html -->

6 <!-- XHTML headers -->

7

8 <html xmlns = "http://www.w3.org/1999/xhtml">

9 <head>

10 <title>Internet and WWW How to Program - Headers</title>

11 </head>

12

13 <body>

14

15 <h1>Level 1 Header</h1>

16 <h2>Level 2 header</h2>

17 <h3>Level 3 header</h3>

18 <h4>Level 4 header</h4>

19 <h5>Level 5 header</h5>

20 <h6>Level 6 header</h6>

21

22 </body>

23 </html>

Page 17: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML17

Page 18: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML18

Linking

Hyperlink– References other sources such as XHTML

documents and images– Both text and images can act as hyperlinks– Created using the a (anchor) element: <a> </a>

Attribute href specifies the location of a linked resource : href = “http://www.yahoo.com”

Link to e-mail addresses: href = “mailto:[email protected]

Page 19: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML19

links.html(1 of 2)

1 <?xml version = "1.0"?>

2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"

3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

4

5 <!-- Fig. 4.5: links.html -->

6 <!-- Introduction to hyperlinks -->

7

8 <html xmlns = "http://www.w3.org/1999/xhtml">

9 <head>

10 <title>Internet and WWW How to Program - Links</title>

11 </head>

12

13 <body>

14

15 <h1>Here are my favorite sites</h1>

16

17 <p><strong>Click a name to go to that page.</strong></p>

18

19 <!-- Create four text hyperlinks -->

20 <p><a href = "http://www.deitel.com">Deitel</a></p>

21

22 <p><a href = "http://www.prenhall.com">Prentice Hall</a></p>

23

24 <p><a href = "http://www.yahoo.com">Yahoo!</a></p>

25

Page 20: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML20

contact.html(1 of 1)

1 <?xml version = "1.0"?>

2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"

3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

4

5 <!-- Fig. 4.6: contact.html -->

6 <!-- Adding email hyperlinks -->

7

8 <html xmlns = "http://www.w3.org/1999/xhtml">

9 <head>

10 <title>Internet and WWW How to Program - Contact Page</title>

11 </head>

12

13 <body>

14

15 <p>

16 My email address is

17 <a href = "mailto:[email protected]">

18 [email protected]

19 </a>

20 . Click the address and your browser will

21 open an e-mail message and address it to me.

22 </p>

23 </body>

24 </html>

Page 21: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML21

Malicious Link Manipulation

Phishing: a link in an email leads to the spoofed website– Make the anchor text for a link appear to be valid

<a href=“http://www.badsite.com”>

www.paypal.com

</a>– Misspelled URL

<a href=“http://www.bananarepubli.com”>BR</a>

Page 22: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML22

Images (1)

Three most popular formats– Graphics Interchange Format (GIF)– Joint Photographic Experts Group (JPEG)– Portable Network Graphics (PNG)– img element with attributes:

src attribute : Specifies the location of the image file width and height attributes: Pixels (“picture elements”) alt attribute : the text will be displayed if the browser could

not display the image.

Page 23: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML23

Images (2)

Empty elements– Terminated by character / inside the closing right

angle bracket (>), or by explicitly including the end tag– Example:<img src=“1.jpg” height=“238” width=“183” />

br element: Line break– <br />

<strong> tag: <strong>Bold characters</strong>– Bold

Page 24: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML24

picture.html(1 of 1)

1 <?xml version = "1.0"?>

2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"

3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

4

5 <!-- Fig. 4.7: picture.html -->

6 <!-- Adding images with XHTML -->

7

8 <html xmlns = "http://www.w3.org/1999/xhtml">

9 <head>

10 <title>Internet and WWW How to Program - Welcome</title>

11 </head>

12

13 <body>

14

15 <p>

16 <img src = "xmlhtp.jpg" height = "238" width = "183"

17 alt = "XML How to Program book cover" />

18 <img src = "jhtp.jpg" height = "238" width = "183"

19 alt = "Java How to Program book cover" />

20 </p>

21 </body>

22 </html>

Page 25: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML25

Page 26: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML26

Image as Link

Use an image as a link <a href=“http://www.yahoo.com”>

<img src= "yahoo.gif" width="232" height = "44" /> </a>

Image has no border <a href="FirstExample.html"> <img src="home.png" width="125" height="26" alt="Go Home" border="0" /> </a>

Page 27: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML27

nav.html(1 of 2)

1 <?xml version = "1.0"?>

2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"

3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

4

5 <!-- Fig. 4.8: nav.html -->

6 <!-- Using images as link anchors -->

7

8 <html xmlns = "http://www.w3.org/1999/xhtml">

9 <head>

10 <title>Internet and WWW How to Program - Navigation Bar

11 </title>

12 </head>

13

14 <body>

15

16 <p>

17 <a href = "links.html">

18 <img src = "buttons/links.jpg" width = "65"

19 height = "50" alt = "Links Page" />

20 </a><br />

21

22 <a href = "list.html">

23 <img src = "buttons/list.jpg" width = "65"

24 height = "50" alt = "List Example Page" />

25 </a><br />

Page 28: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML28

Page 29: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML29

Internal Linking

Enables the user to jump between locations in the same document– First, create an internal hyperlink destination by

setting attribute id of an element– Second, create an internal link to this element.– Example:

<h1 id=“bugs”>Bugs </h1> :

<a href=“#bugs”>Go to Bugs</a>

Page 30: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML30

links.html(1 of 3)

1 <?xml version = "1.0"?>

2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"

3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

4

5 <!-- Fig. 5.6: links.html -->

6 <!-- Internal Linking -->

7

8 <html xmlns = "http://www.w3.org/1999/xhtml">

9 <head>

10 <title>Internet and WWW How to Program - List</title>

11 </head>

12

13 <body>

14

15 <!-- id attribute creates an internal hyperlink destination -->

16 <h1 id = "features">The Best Features of the Internet</h1>

17

18 <!-- an internal link's address is "#id" -->

19 <p><a href = "#bugs">Go to <em>Favorite Bugs</em></a></p>

20

21 <ul>

22 <li>You can meet people from countries

23 around the world.</li>

24

25 <li>You have access to new media as it becomes public:

Page 31: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML31

links.html(3 of 3)

51 <li>Keeping in touch with old friends</li>

52 <li>It is the technology of the future!</li>

53 </ul>

54

55 <!-- id attribute creates an internal hyperlink destination -->

56 <h1 id = "bugs">My 3 Favorite Bugs</h1>

57

58 <p>

59

60 <!-- internal hyperlink to features -->

61 <a href = "#features">Go to <em>Favorite Features</em>

62 </a></p>

63

64 <ol>

65 <li>Fire Fly</li>

66 <li>Gal Ant</li>

67 <li>Roman Tic</li>

68 </ol>

69

70 </body>

71 </html>

Page 32: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML32

Creating and Using Image Maps (1)

Designate certain areas of an image (called hotspots) as links– Element map

Attribute id identifies the image map

– Element img Attribute usemap refers the map by id.

– Example: <map id=“picOne”> .. </map><img src=“picture.gif” usemap=“#picOne” />

Page 33: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML33

Creating and Using Image Maps (2)

Element area defines hotspot– Attribute shape and coords

Specify the hotspot’s shape and coordinates Rectangular ( shape = “rect” ) Polygon ( shape = “poly” ) Circle ( shape = “circle” )

– Attribute href Specifies the link’s target.

– Attribute alt Provides alternative text for the link.

Page 34: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML34

picture.html(1 of 3)

1 <?xml version = "1.0" ?>

2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

4

5 <!-- Fig. 5.7: picture.html -->

6 <!-- Creating and Using Image Maps -->

7

8 <html xmlns = "http://www.w3.org/1999/xhtml">

9 <head>

10 <title>

11 Internet and WWW How to Program - Image Map

12 </title>

13 </head>

14

15 <body>

16

17 <p>

18

19 <!-- the <map> tag defines an image map -->

20 <map id = "picture">

21

22 <!-- shape = "rect" indicates a rectangular -->

23 <!-- area, with coordinates for the upper-left -->

24 <!-- and lower-right corners -->

Page 35: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML35

picture.html(2 of 3)

25 <area href = "form.html" shape = "rect"

26 coords = "2,123,54,143"

27 alt = "Go to the feedback form" />

28 <area href = "contact.html" shape = "rect"

29 coords = "126,122,198,143"

30 alt = "Go to the contact page" />

31 <area href = "main.html" shape = "rect"

32 coords = "3,7,61,25" alt = "Go to the homepage" />

33 <area href = "links.html" shape = "rect"

34 coords = "168,5,197,25"

35 alt = "Go to the links page" />

36

37 <!-- value "poly" creates a hotspot in the shape -->

38 <!-- of a polygon, defined by coords -->

39 <area shape = "poly" alt = "E-mail the Deitels"

40 coords = "162,25,154,39,158,54,169,51,183,39,161,26"

41 href = "mailto:[email protected]" />

42

43 <!-- shape = "circle" indicates a circular -->

44 <!-- area with the given center and radius -->

45 <area href = "mailto:[email protected]"

46 shape = "circle" coords = "100,36,33"

47 alt = "E-mail the Deitels" />

48 </map>

49

Page 36: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML36

50 <!-- <img src =... usemap = "#id"> indicates that the -->

51 <!-- specified image map is used with this image -->

52 <img src = "deitel.gif" width = "200" height = "144"

53 alt = "Deitel logo" usemap = "#picture" />

54 </p>

55 </body>

56 </html>

Page 37: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML37

Unordered Lists

Unordered list element ul– Creates a list in which each item begins with a

bullet symbol (called a disc)– li (list item): Entry in an unordered list– Format: <ul>

<li> </li> <li> </li></ul>

Page 38: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML38

links2.html(1 of 2)

1 <?xml version = "1.0"?>

2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"

3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

4

5 <!-- Fig. 4.10: links2.html -->

6 <!-- Unordered list containing hyperlinks -->

7

8 <html xmlns = "http://www.w3.org/1999/xhtml">

9 <head>

10 <title>Internet and WWW How to Program - Links</title>

11 </head>

12

13 <body>

14

15 <h1>Here are my favorite sites</h1>

16

17 <p><strong>Click on a name to go to that page.</strong></p>

18

19 <!-- create an unordered list -->

20 <ul>

21

22 <!-- add four list items -->

23 <li><a href = "http://www.deitel.com">Deitel</a></li>

24

25 <li><a href = "http://www.w3.org">W3C</a></li>

Page 39: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML39

26

27 <li><a href = "http://www.yahoo.com">Yahoo!</a></li>

28

29 <li><a href = "http://www.cnn.com">CNN</a></li>

30 </ul>

31 </body>

32 </html>

Page 40: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML40

Nested and Ordered Lists

Represent hierarchical relationships Ordered lists (ol)

– Creates a list in which each item begins with a number

– Format <ol> <li> </li> <li> </li></ol>

Page 41: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML41

list.html(1 of 3)

1 <?xml version = "1.0"?>

2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"

3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

4

5 <!-- Fig. 4.11: list.html -->

6 <!-- Advanced Lists: nested and ordered -->

7

8 <html xmlns = "http://www.w3.org/1999/xhtml">

9 <head>

10 <title>Internet and WWW How to Program - Lists</title>

11 </head>

12

13 <body>

14

15 <h1>The Best Features of the Internet</h1>

16

17 <!-- create an unordered list -->

18 <ul>

19 <li>You can meet new people from countries around

20 the world.</li>

21 <li>

22 You have access to new media as it becomes public:

23

Page 42: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML42

list.html(2 of 3)

24 <!-- this starts a nested list, which uses a -->

25 <!-- modified bullet. The list ends when you -->

26 <!-- close the <ul> tag. -->

27 <ul>

28 <li>New games</li>

29 <li>

30 New applications

31

32 <!-- nested ordered list -->

33 <ol>

34 <li>For business</li>

35 <li>For pleasure</li>

36 </ol>

37 </li>

38

39 <li>Around the clock news</li>

40 <li>Search engines</li>

41 <li>Shopping</li>

42 <li>

43 Programming

44

45 <!-- another nested ordered list -->

46 <ol>

47 <li>XML</li>

48 <li>Java</li>

Page 43: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML43

list.html(3 of 3)

49 <li>XHTML</li>

50 <li>Scripts</li>

51 <li>New languages</li>

52 </ol>

53

54 </li>

55

56 </ul> <!-- ends the nested list of line 27 -->

57 </li>

58

59 <li>Links</li>

60 <li>Keeping in touch with old friends</li>

61 <li>It is the technology of the future!</li>

62

63 </ul> <!-- ends the unordered list of line 18 -->

64

65 </body>

66 </html>

Page 44: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML44

Page 45: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML45

Type of Ordered List

Attribute type defines the type of list Available types:

type=“A” type=“a” type=“I” type=“i” type=“1”

Page 46: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML46

Type of Unordered List

Attribute type defines the type of list Available types:

type=“disc” type=“square” type=“circle”

Page 47: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML47

Special Characters and More Line Breaks

Character entity references: &code; Numeric character references (e.g. &#38;)

– See Appendix A, (page 1429)– A complete list :http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html

<del> </del> : Strike-out text <sup> </sup> : Superscript text <sub> </sub> : Subscript text <hr /> : Horizontal rule (horizontal line)

Page 48: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML48

contact2.html(1 of 2)

1 <?xml version = "1.0"?>

2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"

3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

4

5 <!-- Fig. 4.9: contact2.html -->

6 <!-- Inserting special characters -->

7

8 <html xmlns = "http://www.w3.org/1999/xhtml">

9 <head>

10 <title>Internet and WWW How to Program - Contact Page

11 </title>

12 </head>

13

14 <body>

15

16 <!-- special characters are entered -->

17 <!-- using the form &code; -->

18 <p>

19 Click

20 <a href = "mailto:[email protected]">here

21 </a> to open an e-mail message addressed to

22 [email protected].

23 </p>

24

25 <hr /> <!-- inserts a horizontal rule -->

Page 49: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML49

contact2.html(2 of 2)

26

27 <p>All information on this site is <strong>&copy;</strong>

28 Deitel <strong>&amp;</strong> Associates, Inc. 2002.</p>

29

30 <!-- to strike through text use <del> tags -->

31 <!-- to subscript text use <sub> tags -->

32 <!-- to superscript text use <sup> tags -->

33 <!-- these tags are nested inside other tags -->

34 <p><del>You may download 3.14 x 10<sup>2</sup>

35 characters worth of information from this site.</del>

36 Only <sub>one</sub> download per hour is permitted.</p>

37

38 <p>Note: <strong>&lt; &frac14;</strong> of the information

39 presented here is updated daily.</p>

40

41 </body>

42 </html>

Page 50: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML50

W3C XHTML Validation Service (1)

Validation service ( validator.w3.org )– Checking a document’s syntax

URL that specifies the location of the file Uploading a file to the site validator.w3.org/file-upload.html

Page 51: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML51

W3C XHTML Validation Service (2)

Page 52: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML52

Web Resources

www.w3.org/TR/xhtml11 www.xhtml.org www.w3schools.com/xhtml/default.asp validator.w3.org hotwired.lycos.com/webmonkey/00/50/

index2a.html wdvl.com/Authoring/Languages/XML/XHTML www.w3.org/TR/2001/REC-xhtml11-20010531

Page 53: Introduction to XHTML 1 Chapter 4 Introduction to XHTML: Part 1 Reference From: Internet & World Wide Web: How to Program Deitel, Deitel & Goldburg.

Introduction to XHTML53

Reference

Reproduced from the PowerPoints for Internet & World Wide Web How to Program, 3e by Deitel, Deitel and Goldberg © 2004.

Reproduced by permission of Pearson Education, Inc.