HTML5 Overview and Basic Tags
HTML5 Overview and Basic Tags
2
Objectives (continued 1)
• Mark page structures with sectioning elements
• Organize page content with grouping elements
• Mark content with text-level elements
• Insert inline images
• Insert symbols based on character codes
3
Objectives (continued 2)
• Mark content using lists
• Create a navigation list
• Link to files within a website with hypertext links
4
Introducing HTML
• A Web page is a text file written in HTML (Hypertext Markup Language)
• A markup language describes the content and structure of a document
by identifying, or tagging, different document elements
6
The History of HTML (continued 1)
• The W3C has no enforcement power
• The recommendations of the W3C are usually followed since a uniform
approach to Web page creation is beneficial to everyone
7
The History of HTML (continued 2)
8
The History of HTML (continued 3)
9
Tools for Working with HTML
• Basic text editor such as Windows Notepad
• Other HTML editors such as Notepad++, UltraEdit, CoffeeCup, BBEdit,
and ConTEXT
10
The Element Hierarchy
<!DOCTYPE html>
<html>
<head>
head content
</head>
<body>
body content
</body>
</html>
12
The Structure of an HTML5 Document
13
Exploring an HTML File
<!DOCTYPE html>
15
Creating the Document Head
• The document head contains metadata
• Metadata is the content that describes or provides information about
how the document should be processed by the browser
16
Creating the Document Head (continued)
18
Adding Metadata to the Document
• Meta element is used for general lists of metadata values.
The meta element structure is
<meta attributes />
• Character encoding is the process by which a computer converts text
into a sequence of bytes and vice versa when it stores the text and
when the text is read.
19
Adding Metadata to the Document (continued)
20
Adding Comments to Your Document
• A comment is descriptive text that is added to the HTML file but does not
appear in the browser window
<!-- comment -->
• Comments can be spread across several lines
• It is a good practice to always include a comment in the document head
21
Adding Comments to your Document
(continued)
22
Introducing Element Tags
• Element tag is the fundamental building block in every HTML document
that marks an element in the document
• A starting tag (<element>) indicates the beginning of an element, while
an ending tag (</element>) indicates the ending
• The general syntax of a two-sided element tag is
<element>content</element>
23
Writing the Page Body
28
Using Grouping Elements
29
Element Sample Output
<hr />
34
Using Text-Level Elements
Element Sample Output
aabr abbreviat The <abbr title="World Wide The WWW (World Wide Web) is a
ion Web">WWW</abbr> is a global global system of interlinked
system of interlinked
hypertext documents that are
hypertext documents that
are accessed via the accessed via the Internet.
Internet.
br line break This is the first line.<br> This is the first line.
This is the second line This is the second line.
i <p>I looked at it and thought <i>This can't be I looked at it and thought This
real!</i></p> can't be real!
<p><i>Musa</i> is one of two or three genera in the Musa is one of two or three
family <i>Musaceae</i>; it includes bananas and genera in the family Musaceae; it
plantains.</p> includes bananas and plantains.
Kbd <p>Please press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> Please press Ctrl + Shift + R to re-
(keyboard) + <kbd>R</kbd> to re-render an MDN page.</p> render an MDN page.
<hr />
samp <p>I was trying to boot my computer, but I got this I was trying to boot my computer,
hilarious message:</p> but I got this hilarious message:
small <p>MDN Web Docs is a learning platform for Web MDN Web Docs is a learning
technologies and the software that powers the platform for Web technologies
Web.</p> and the software that powers the
Web.
<hr />
<p><small>The content is licensed under a Creative The content is licensed under a Creative
Commons Attribution-ShareAlike 2.5 Generic Commons Attribution-ShareAlike 2.5 Generic
License.
License.</small></p>
<p>Fernstraßen­bau­privat­finanzierungs­g
esetz</p>
</div>
External Styling: Linking HTML to Style Sheet
• A style sheet is a set of rules specifying how page elements are displayed; it is
written in the Cascading Style Sheet (CSS) language
• To link an HTML document to an external style sheet file, add the following
element:
<link href=”file” rel=”stylesheet” />
47
Working with Hypertext Links
• Hypertext is created by enclosing content within a set of opening and closing
<a> tags like:
<a href=“url”>content</a>
where url is Uniform Resource Locator (URL)
• Inline images can also be turned into links by enclosing the image within
opening and closing <a> tags
<a href=“ct_start.html”><img src=“ct_logo2.png” /></a>
57
● header: <header>.
● navigation bar: <nav>.
● main content: <main>, with various content subsections represented by
<article>, <section>, and <div> elements.
● sidebar: <aside>; often placed inside <main>.
● footer: <footer>.