02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Integrating the P tag (paragraph tag)

In this video, we introduce the P tag (<p>), used for creating paragraphs in HTML. Learn how to add text between opening and closing <p> tags, ensuring proper structure and readability. By the end of this video, you’ll know how to use the paragraph tag effectively to add body text to your HTML pages.

Video Transcript

00:00Maybe in between our 'h1' titles
00:04we probably want to have some sort of a 'body'
00:05some sort of a text that would go inside
00:08some sort of a paragraph
00:09Just as we've learnt earlier we could create a paragraph,
00:12opening and closing brackets -always,
00:14in the paragraph we could write here:
00:16'I don't know what to buy my monster for her birthday, I'll think about it.'
00:30right, so this is not really most creative text ever,
00:33and probably our text is a little bit too big
00:35so let's get it a little bit smaller, so it's easier for you guys to see what's going on.
00:39Let's recap what we have done so far

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!

Lesson notes

In this tutorial, we’ll learn about the P tag in HTML, which is used to create paragraphs. This tag is essential for adding structured text to your webpage.


1. What is the P Tag?

The P tag (<p>) is used to define a paragraph of text in HTML. Like other tags, it requires an opening tag (<p>) and a closing tag (</p>).

Example:

<p>This is a paragraph of text.</p>

When viewed in a browser, the text will appear as a block with some default spacing above and below.


2. Adding a Paragraph to Your HTML Page

Follow these steps to create a paragraph:

  1. Open Your HTML File:

    • Use any plain text editor.
  2. Insert the P Tag:
    Add the following code inside the <body> tag of your HTML file:

    <body>
      <h1>What to Buy Mom for Her Birthday</h1>
      <p>I don't know what to buy my monster for her birthday, I'll think about it.</p>
    </body>
    
  3. Save and Test:
    Save the file with the .html extension and open it in your browser. You’ll see the headline and the paragraph displayed.


3. Why Use the P Tag?

  1. Readability:

    • Text wrapped in <p> tags is easier to read and organize.
  2. Default Styling:

    • Browsers automatically apply spacing to paragraphs, making them visually distinct from other content.
  3. SEO and Accessibility:

    • Using <p> tags ensures your content is semantically correct, which helps search engines and accessibility tools understand your page.

4. Example of Multiple Paragraphs

Here’s an example of a page with multiple paragraphs:

<html>
  <head>
    <title>HTML Paragraphs Example</title>
  </head>
  <body>
    <h1>What to Buy Mom for Her Birthday</h1>
    <p>I don't know what to buy my monster for her birthday, I'll think about it.</p>
    <p>Maybe a personalized gift, or something handmade? It's hard to decide!</p>
  </body>
</html>

5. Best Practices for Using P Tags

  • Break Long Text: Avoid putting too much text in a single <p> tag. Use multiple paragraphs for clarity.
  • Keep It Relevant: Each paragraph should focus on one idea or topic.
  • Combine with Other Tags: Use <p> tags alongside headlines (<h1> to <h6>) to create structured and readable content.

Summary

By the end of this tutorial, you’ve learned:

  1. How to use the <p> tag to create paragraphs in HTML.
  2. The importance of structuring your text for readability.
  3. Best practices for using paragraphs effectively.

What’s Next?

In the next tutorial, we’ll explore more ways to structure and style text in HTML, including bold and italic formatting.

Continue learning: HTML Training with Mom.