Write a program to create a webpage to print values 1 to 5
Description: Create a web page that prints the values 1 to 5. Each value should be on a new line.
Hint:
- Use one
<p>tag for each value, or the<br>tag for a line break.
HTML program to print 1 to 5
<!DOCTYPE html>
<html lang="en">
<head>
<title>Numbers</title>
</head>
<body>
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
</body>
</html>
Output in the browser:
Output in the browser
1
2
3
4
5
How it works
- Every
<p>tag is a paragraph, and the browser puts each paragraph on a new line. - You can also write
1<br>2<br>3<br>4<br>5inside one paragraph. The<br>tag gives a line break. - If you want a numbered list, use
<ol>. See HTML Lists.
Learn more about the similar topics:
| Tutorials |
|---|
| HTML Headings |
| HTML Paragraphs |
| HTML Styles |
| HTML Formatting |
| HTML Comments |
| HTML Symbols |