开发者

A good usage of HTML5's "progress" or "meter"?

Say you have a survey with 10 pages (one question per page). At the top of each page, you include the text, "Question 2 of 10". Is this kind of a thing a good c开发者_运维百科andidate for "progress" or "meter"?

Semantically speaking, "progress" initially seems like the best fit. But, the more I read and look at examples, I think "meter" may be more appropriate.

<meter max="10" value="1">Question 1 of 10</meter>
<progress max="10" value="1">Question 1 of 10</progress>


According to the latest HTML5 working draft, the progress tag is best used to display the progress of a specific task at hand. meter is best used for task-unrelated guages, such as disk space or memory usage.

The progress element represents the completion progress of a task.

Whereas

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.

Edit - as rendering and styling seems to be an issue, you might have more luck using other tags. For example a sexy progress navigator could be coded with:

<nav class="progress">
    <ol>
        <li class="active">Your Info</li>
        <li>General</li>
        <li>Detailed</li>
        <li>Last Step</li>
    </ol>
</nav>

And styled with something like this.


Semantically speaking, progress does appear to be the right thing to use here. I also posed the question to HTML5 Doctor, and they seemed to agree with that as well. My problem is that progress is very poorly supported across the board at the moment (7/5/11). This make it very hard to use in a practical use case today.

As a stop gap, I am planning to use the convention of using the new element name as a class name in a standard div element (A.K.A. - A semantic class name). For more details, on this idea: http://jontangerine.com/log/2008/03/preparing-for-html5-with-semantic-class-names

Here's what my code will look like today. In another year or two, when this element has better support, I'll go back and replace this with real progress tags.

<div class="progress" role="progressbar" aria-valuenow="1" aria-valuemin="1" aria-valuemax="10">
    Question 1 of 10
</div>


The <meter> tag defines a scalar measurement within a known range or a fractional value. This is also known as a gauge.

On Google Chrome, the resulting meter looks like this:

A good usage of HTML5's "progress" or "meter"?

The <progress> tag is used to show the completion progress of a task.

On Windows 7, the resulting progress looks like this:

A good usage of HTML5's "progress" or "meter"?

Note: The <meter> tag should not be used to indicate progress (as in a progress bar). For progress bars, use the <progress> tag.


Since this value is a determinate one, it seems "meter" would be better. Try this reference and see if it helps: http://peter.sh/examples/?/html/meter-progress.html


Meters aren't supported by IE. Not even IE10.


Visually speaking, I think a meter is more appropriate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜