A good usage of HTML5's “progress” or “meter”?

隐身守侯 提交于 2019-11-30 02:47:20

问题


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 candidate 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>

回答1:


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.




回答2:


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>



回答3:


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




回答4:


Visually speaking, I think a meter is more appropriate.




回答5:


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




回答6:


definitely meter; see a demo here




回答7:


The 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:

The progress element is used to show the completion progress of a task.

On Windows 7, the resulting progress looks like this:

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



来源:https://stackoverflow.com/questions/6552100/a-good-usage-of-html5s-progress-or-meter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!