w3resource

HTML5: How to define a paragraph?

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

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.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/html-css-exercise/basic/p-answer.php