w3resource

HTML5: How to represent the progress of a task?

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Define document type as HTML5 -->
<html><!-- Start of HTML document -->
<head><!-- Start of head section -->
<meta charset="utf-8"><!-- Define character encoding -->
<title>How to represent the progress of a task</title><!-- Title of the document -->
</head><!-- End of head section -->
<body><!-- Start of body section -->
Downloading progress: <!-- Text indicating the purpose of the progress element -->
<progress value="50" max="100"><!-- Define a progress element -->
</progress><!-- End of progress element -->
</body><!-- End of body section -->
</html><!-- End of HTML document -->

Explanation:

  • This HTML code demonstrates how to represent the progress of a task using the <progress> element.
  • The <progress> element is used to indicate the completion progress of a task.
  • Inside the <progress> element, the value attribute specifies the current progress value, which in this case is set to 50.
  • The max attribute specifies the maximum value of the progress, which in this case is set to 100.
  • The text "Downloading progress:" before the <progress> element provides a description or context for the progress indicator.

Live Demo:

See the Pen progress-answer by w3resource (@w3resource) on CodePen.


See the solution in the browser

Supported browser

Firefox logo Chrome logo Opera logo Safari logo Internet Explorer logo
Yes Yes Yes Yes Yes

Go to Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.