HTML
HTML
with HTML5
2.1. Choose and configure HTML5 tags to display text content.
2.2. Choose and configure HTML5 tags to display graphics.
2.3. Choose and configure HTML5 tags to play media.
Agenda
HTML Media in HTML5
Text Elements
Displaying Graphics
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Basic HTML</title>
</head>
<body>
<h1>This is a Basic Header</h1>
<p>This is a basic paragraph.</p>
</body>
</html>
Versions of HTML
• Throughout the 2000s, HTML 4.01 was the standard for web pages
• A strong demand for a rich web experience, including audio, video, and
interactivity led to the development of a new HTML standard
HTML5
• The World Wide Web Consortium (W3C) is the standards organization
responsible for the development of HTML5
• The HTML5 standard encompasses HTML markup tags, Cascading Style
Sheets (CSS), and JavaScript
• HTML5 is platform-independent
New with HTML5
FEATURE DESCRIPTION
Audio and video tags Embeds video on web pages using the <audio> and <video> tags
Media queries A feature in CSS3 that detects screen size and adjusts output to fit
New application Provides access to many digital resources that can be incorporated
programming into the code of web applications
interfaces
Geolocation Uses JavaScript to detect the geographic location of a device
HTML Tags
opening tag
<!DOCTYPE html>
<head><html>
<html lang="en">
</html>
<h1>This is a basic header</h1>
<p>This is a basic paragraph.</p>
</body>
</html>
Common HTML Tags
TAG PURPOSE
<html> identifies a page as an HTML document
<head> contains code used by the browser to add interactivity or style a
page
<title> title of a document
<body> surrounds content that is visible on a Web page
<p> paragraphs
<a href=“URL”> links
<h1> top heading
<img> images
Using Attributes
• Tags are used in combination with attributes to describe how data should be
rendered on a Web page
• Each element has a specific set of attributes that can be used with it
<a href="http://www.bing.com">Bing</a>
TAG ATTRIBUTE VALUE TEXT
Nesting Elements
• Creating awesome web pages requires you to combine elements, their
attributes, and engaging content
• When two or more elements apply to the same block of content, then you
have to nest tag pairs
• Nesting is the process of placing one element inside of another
parent
child
<p>I <em>love</em> taking my dog for a
walk.</p>
I love taking my dog for a walk.
Special Characters in HTML
• A special character, such as a percent sign or a copyright symbol, is known
as an entity in HTML
• Including entities in a Web page requires character encoding or the special
characters will not render
• The <img> tag requires use of the src and alt attributes
• src defines the pathway for the image file, while the value of the alt
attribute makes text accessible to people with disabilities
Attributes of the img element
ATTRIBUTE VALUE DESCRIPTION
src URL Specifies the location of an image
alt Text Specifies alternate text for an image, which displays
when a user hovers their mouse pointer over it
height pixels Specifies the height of an image
width pixels Specifies the width of an image
ismap ismap Specifies an image as a server-side image map
usemap #mapname Specifies an image as a client-side image map
figure and figcaption Elements
• The img element can be used in combination with two new elements,
figure and figcaption, to organize images and provide captions
• The figure element specifies the type of figure that is being added, and
can also be used to group images side by side
• The figcaption element can be used to add captions before or after
images
<figure>
<figcaption>Who wouldn't want to take this dog for a walk?</figcaption>
<img src="dog.jpg" alt="This is a picture of my dog, Stella." title="Stella"/>
</figure>
The canvas Element
• The canvas element creates a blank container for graphics
• It’s a new element in HTML5 and you can draw graphics using JavaScript
<audio controls>
<source src=“myaudio.mp3” type=“audio/mp3”/>
<source src=“myaudio.ogg” type=“audio/ogg”/>
</audio>
Summary
HTML Media in HTML5
Text Elements
Displaying Graphics