Skip to Content
Programming HTML5 Applications
book

Programming HTML5 Applications

by Zachary Kessin
November 2011
Intermediate to advanced
140 pages
3h 46m
English
O'Reilly Media, Inc.
Content preview from Programming HTML5 Applications

Chapter 10. New Tags

In addition to a lot of new interfaces for working with data, HTML5 also introduces a number of new HTML tags that can be used in a web page to enhance the application developer’s ability to put out a quality application.

Tags for Applications

A common task in any application is to give the user feedback on how far along a long-running task is. This lets the user know that her task is moving and that something didn’t freeze up. It is possible to show a progress meter by using a few <div> elements and some custom CSS, but HTML5 standardizes the procedure and appearance through a new <progress> tag. As of this writing, the tag is supported in Firefox and Chrome. It offers two attributes to make it easy to visualize progress to the user: value to show the current value of the progress bar and max to show the maximum value.

In order to show a progress indication to users of legacy browsers, it is recommended that you include some form of text inside a <span> element inside the progress bar.

Example 10-1 shows the code for a progress bar at 20% completion. Example 6-4 shows how JavaScript can update the attributes as events in the program indicate progress. The progress bar can also be styled with CSS like any other HTML element.

Example 10-1. Progress indicator

<!DOCTYPE html>
<html>
  <head>
    <title>Progress</title>
  </head>
  <body>
    <progress value="20" max="100">
      <span>running</span>
    </progress>
  </body>
</html>

If the <progress> element can be used to show a running event, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

HTML5: Up and Running

HTML5: Up and Running

Mark Pilgrim
HTML5 Cookbook

HTML5 Cookbook

Christopher Schmitt, Kyle Simpson

Publisher Resources

ISBN: 9781449308568Errata Page