HTML5: How to define a paragraph?
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 define a
paragraph</title><!-- Title of the document -->
</head><!-- End of head section -->
<body><!-- Start of body section -->
<p>This is an HTML paragraph.</p><!-- Define a paragraph element -->
</body><!-- End of body section -->
</html><!-- End of HTML document -->
Explanation:
- The HTML code defines a simple webpage with a single paragraph.
- It includes a document type declaration (<!DOCTYPE html>) to specify that the document is an HTML5 document.
- Inside the <html> element, there's a <head> section containing metadata about the document, such as the character encoding (<meta charset="utf-8">) and the title of the webpage (<title>).
- The <body> section contains the actual content of the webpage, which in this case is a single paragraph (<p>).
- The paragraph contains the text "This is an HTML paragraph." which will be displayed on the webpage.
Live Demo:
See the Pen p-answer by w3resource (@w3resource) on CodePen.
See the solution in the browser
Supported browser
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics