HTML Paragraphs

HTML Paragraph is a block of text that starts in a new line. In HTML, <p> tag is used to define a paragraph.

Code

In the following code snippet, we define a paragraph with Hello World text.

<p>Hello World</p>

Examples

A Simple Paragraph Element

In the following example, we define a simple paragraph element in a HTML file.

index.html

<!DOCTYPE html>
<html lang="en">
  <body>
    <p>Hello World</p>
  </body>
</html>

Paragraph with CSS

In the following example, we define two paragraph elements in a HTML file, and define CSS for all paragraphs in the HTML file.

index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <style>
      p {
        color: green;
        border: 1px solid gray;
        padding: 10px;
      }
    </style>
  </head>
  <body>
    <p>Hello World!</p>
    <p>Welcome to HTML Tutorial!</p>
  </body>
</html>