Lesson 7 / الدرس 7

Paragraphs / الفقرات

The <p> tag marks one paragraph, one idea. The browser collapses every space and line break inside it into a single space, and adds its own spacing above and below.

الوسم <p> يُعرِّف فقرة واحدة، فكرة واحدة. والمتصفح يدمج كل مسافة وسطر جديد داخلها في مسافة واحدة، ويضيف تباعده الخاص فوقها وتحتها.

A paragraph is a block of text that carries one idea. In HTML you write it with the <p> tag: everything between the opening <p> and the closing </p> belongs to that one idea. The browser automatically adds space above and below every paragraph, even though you never wrote any CSS for it.

<p>This is my first paragraph.</p>
<p>And this is a second one.</p>
Two paragraphs. Notice each one opens with <p> and closes with </p>.

The browser ignores your extra spaces

If you press Enter many times, add many spaces, or even use a tab inside a paragraph, the browser collapses that entire run into one single space. This rule is called whitespace collapsing, and it treats every space, tab and line break the same way — HTML never distinguishes between them. It exists so you are free to format your source file for your own eyes: indent it, break long lines, leave blank lines between paragraphs for readability — none of that changes what appears on the page.

<p>These      spaces


and line breaks all become one space.</p>
Run this — the output is a single tidy line.

So where does the gap between paragraphs come from?

Not from a blank line you typed — you just saw that the browser throws those away. It comes from <p> itself: every browser ships with a default stylesheet, and in it <p> is a block element with margin above and below built in. A block element always takes the full width of its container and stacks under whatever came before it, which is why two paragraphs never sit side by side. Later, when you learn CSS, you will be able to change or remove that default margin — but until then, the browser supplies it for you automatically.

  • <p> is a block element — it takes the full width of its container.
  • The closing tag </p> is required in good practice.
  • You can put text, links and images inside a paragraph.
  • Do not add empty <p></p> pairs just to create blank space — that space is CSS's job, not the paragraph's.
TagWhat it does
<p>Opens a paragraph
</p>Closes a paragraph
<br>Line break inside a paragraph

The tags used in this lesson.

Try it live / جرّب بنفسك

Preview / المعاينة

Check yourself / اختبر نفسك

1. Which tag defines a paragraph?

2. What happens to five spaces in a row inside a paragraph?

3. Is it correct to write a <p> inside another <p>?

Your task / مهمتك

Write a page that introduces you: a heading with your name, then three paragraphs — where you live, what you are learning, and why.

اكتب صفحة تعرّف بك: عنوان باسمك، ثم ثلاث فقرات — أين تسكن، وماذا تتعلم، ولماذا.

  • One <h1> with your name وسم <h1> واحد باسمك
  • Exactly three <p> elements ثلاث فقرات <p> بالضبط
  • Every tag is properly closed كل وسم مغلق بشكل صحيح
How do you want to submit? / كيف تريد التسليم؟