HTML5
HTML5
HTML5
5
2008 Pearson Education, Inc. All rights reserved.
6
2008 Pearson Education, Inc. All rights reserved.
7
2008 Pearson Education, Inc. All rights reserved.
9
2008 Pearson Education, Inc. All rights reserved.
Comments
Insert comments in your HTML5 markup to
improve readability and describe the content
of a document.
The browser ignores comments when your
document is rendered.
Comments start with <!-- and end with -->.
10
2008 Pearson Education, Inc. All rights reserved.
11
2008 Pearson Education, Inc. All rights reserved.
An
There
12
2008 Pearson Education, Inc. All rights reserved.
Title Element
The title element is called a nested element,
because its enclosed in the head elements start and
end tags.
The head element is also a nested element, because
its enclosed in the html elements start and end tags.
The title element describes the web page.
Titles usually appear in the title bar at the top of the
browser window, in the browser tab on which the page is
displayed, and also as the text identifying a page when
users add the page to their list of Favorites or Bookmarks,
enabling them to return to their favorite sites.
Search engines use the title for indexing purposes and
when displaying results
14
2008 Pearson Education, Inc. All rights reserved.
16
2008 Pearson Education, Inc. All rights reserved.
17
2008 Pearson Education, Inc. All rights reserved.
19
2008 Pearson Education, Inc. All rights reserved.
24
2008 Pearson Education, Inc. All rights reserved.
27
2008 Pearson Education, Inc. All rights reserved.
29
2008 Pearson Education, Inc. All rights reserved.
33
2008 Pearson Education, Inc. All rights reserved.
37
2008 Pearson Education, Inc. All rights reserved.
alt Attribute
A browser may not be able to render an image.
Every img element in an HTML5 document
must have an alt attribute.
If a browser cannot render an image, the
browser displays the alt attributes value.
The alt attribute is also important for
accessibilityspeech synthesizer software can
speak the alt attributes value so that a visually
impaired user can understand what the browser
is displaying. For this reason, the alt attribute
should describe the images contents.
40
2008 Pearson Education, Inc. All rights reserved.
Void Elements
Some HTML5 elements (called void elements)
contain only attributes and do not mark up text
(i.e., text is not placed between a start and an
end tag).
You can terminate void elements (such as the
img element) by using the forward slash
character (/) inside the closing right angle
bracket (>) of the start tag.
For example, lines 1516 of Fig. 2.6 could be
written as follows:
<img src = "jhtp.png" width = "92" height = "120"
alt = "Java How to Program book cover" />
41
2008 Pearson Education, Inc. All rights reserved.
42
2008 Pearson Education, Inc. All rights reserved.
Word abbreviations
Numbers
Decimal
Hexadecimal
46
2008 Pearson Education, Inc. All rights reserved.
www.w3.org/TR/REC-html40/sgml/entities.html
49
2008 Pearson Education, Inc. All rights reserved.
52
2008 Pearson Education, Inc. All rights reserved.
53
2008 Pearson Education, Inc. All rights reserved.
Nested Lists
Lists may be nested to represent
hierarchical relationships, as in a multi-level
outline.
Figure 2.11 demonstrates nested lists and
ordered lists.
The ordered-list element ol creates a list in
which each item begins with a number.
56
2008 Pearson Education, Inc. All rights reserved.
61
2008 Pearson Education, Inc. All rights reserved.
66
2008 Pearson Education, Inc. All rights reserved.
tr Element
Defines individual table rows
Element th
Defines a header cell
Td Element
Contains table data elements
67
2008 Pearson Education, Inc. All rights reserved.
The
68
2008 Pearson Education, Inc. All rights reserved.
73
2008 Pearson Education, Inc. All rights reserved.
77
2008 Pearson Education, Inc. All rights reserved.
78
2008 Pearson Education, Inc. All rights reserved.
Hidden Inputs
Forms can contain visual and nonvisual
components.
Visual components include clickable buttons and
other graphical user interface components with
which users interact.
Nonvisual components, called hidden inputs,
store any data that you specify, such as e-mail
addresses and HTML5 document file names that
act as links.
79
2008 Pearson Education, Inc. All rights reserved.
80
2008 Pearson Education, Inc. All rights reserved.
81
2008 Pearson Education, Inc. All rights reserved.
82
2008 Pearson Education, Inc. All rights reserved.
89
2008 Pearson Education, Inc. All rights reserved.
90
2008 Pearson Education, Inc. All rights reserved.
93
2008 Pearson Education, Inc. All rights reserved.
99
2008 Pearson Education, Inc. All rights reserved.