Introduction to Paragraphs in HTML

Hey friends 👋 welcome back. In the last lesson, we learned what HTML is and how to set up a simple webpage. Today, we are going to look at one of the most basic but very important tags in HTML — the paragraph tag.

A paragraph is simply a block of text on a web page. In books or stories, we separate ideas into paragraphs to make them easier to read. HTML does the same thing for websites. The tag for a paragraph is <p> and it always comes in pairs: <p> ... </p>.

Here is a simple example:

<!DOCTYPE html> <html> <head> <title>Paragraph Example</title> </head> <body> <h1>My First Paragraphs</h1> <p>This is my first paragraph in HTML. It is exciting to learn how to code and build websites.</p> <p>This is another paragraph. Notice how it appears below the first one with space in between.</p> </body> </html>


When you open this file in your browser, you will see two paragraphs of text. Each one is inside its own <p> tags. The browser automatically adds some space before and after each paragraph, so the text does not look squeezed together.

You can add as many paragraphs as you like. Every time you want to start a new idea, just open a new <p> tag and close it after your text. This keeps your webpage neat and easy to read.

Here’s another example with three paragraphs:

<!DOCTYPE html> <html> <head> <title>Three Paragraphs</title> </head> <body> <h1>About Me</h1> <p>My name is Yusuf Ridwanulahi Adeleke. I am 12 years old and I love coding.</p> <p>When I am not coding, I enjoy reading books and exploring new tech ideas.</p> <p>I created this blog to share coding tutorials and inspire other kids to learn programming.</p> </body> </html>

You can also style your paragraphs with CSS to make them look better. For example, you can change the color, font size, or spacing between lines. Try this small style inside the <head> tag:

<style> p { color: green; font-size: 18px; line-height: 1.5; } </style>

This will make all your paragraphs green, slightly larger, and easier to read.

Paragraphs may seem simple, but they are the foundation of almost every webpage. Every article, blog post, or story you read online is made up of many paragraphs. Learning how to use them properly is the first step to organizing your website’s content.

Now it’s your turn. Open your editor, create a file called paragraphs.html, and write at least three paragraphs about your favorite hobby, food, or dream project. Save it, open it in your browser, and see how it looks.

Great job 🎉 You just learned how to use the paragraph tag in HTML. In the next tutorial, we will explore headings (<h1> to <h6>) and see how to use them to give structure to your webpages.