Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Placate Impatient and Curious Users with HTML5 progress and meter Elements

DZone's Guide to

Placate Impatient and Curious Users with HTML5 progress and meter Elements

· Web Dev Zone
Free Resource

Learn how to build modern digital experience apps with Crafter CMS. Download this eBook now. Brought to you in partnership with Crafter Software

HTML5 gives developers new powers, but also makes old tasks easier. Much debate among the standards-makers tries to define the fine line between 'convenient' and 'too particular', and 'a large set of reasonable use-cases' now functions as WHATWG's most important single criterion of feature acceptability (as the debate over the <time> element spotlighted, a bit starkly).

Two of the more particular, developer-conveniencing elements are <progress> and <meter>, which the spec describes as follows:

The progress element represents the completion progress of a task. The progress is either indeterminate, indicating that progress is being made but that it is not clear how much more work remains to be done before the task is complete (e.g. because the task is waiting for a remote host to respond), or the progress is a number in the range zero to a maximum, giving the fraction of work that has so far been completed.

The meter element represents a scalar measurement within a known range, or a fractional value; for example disk usage, the relevance of a query result, or the fraction of a voting population to have selected a particular candidate.

 
Both of these could be developed fairly easily using HTML4 tech, with some simple math (I remember building these in VB) -- but because they address so many different kinds of user experience (i.e., they have so many different use-cases), they proved useful enough to receive entrance into the standard.

The specs on both are fairly simple; read them (progress, meter) for the basics.

Both elements are heavily customizable, however, and especially if they appear frequently on your site, may need to be styled appropriately.

  • The <progress> element exhibits slightly more complex default behavior, depending on the browser-OS combination, so a heavily-exemplified discussion like 'Cross Browser HTML5 Progress Bars In Depth' should help a good deal. None of the code is difficult, and the results can serve many purposes -- so your ROI should be pretty high. Also includes links to recommended polyfills.
  • The behavior of the <meter> element is less intrinsically complex, but its uses are varied enough that strong familiarity will be important. html5doctor's 'Measure up with the meter tag' includes much less styling detail than the <progress> guide, but the focus remains where it probably should be, on marking up the metered data itself.

 

Update: for more pre-formatted CSS3 progress bars, see also this project on github.

Crafter is a modern CMS platform for building modern websites and content-rich digital experiences. Download this eBook now. Brought to you in partnership with Crafter Software.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}