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>: كل ما بين وسم الفتح <p> ووسم الإغلاق </p> ينتمي إلى تلك الفكرة الواحدة. والمتصفح يضيف تلقائيًا مسافة فوق وتحت كل فقرة، رغم أنك لم تكتب أي CSS لذلك.<p>This is my first paragraph.</p>
<p>And this is a second one.</p>
<p> and closes with </p>.
<p> وتغلق بـ </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>
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> نفسه: فكل متصفح يأتي بورقة أنماط افتراضية، وفيها <p> عنصر كتلة له هامش فوق وتحت مدمج فيه. وعنصر الكتلة يأخذ دائمًا العرض الكامل لحاويته، ويصطف تحت ما سبقه، ولهذا لا تجلس فقرتان أبدًا جنبًا إلى جنب. وحين تتعلم CSS لاحقًا ستستطيع تغيير هذا الهامش الافتراضي أو إزالته — لكن حتى ذلك الحين، يوفره لك المتصفح تلقائيًا.<br>. ستتعلمه بالتفصيل في الدرس السابع.<p> يُغلق تلقائيًا بمجرد أن يقابل المتصفح وسم فتح كتلة آخر — بما في ذلك <p> ثانٍ — فوسم الإغلاق الذي توقعته يُتجاهل ببساطة. سيبدو الكود متداخلًا في المحرر، لكن المتصفح لن يعرضه هكذا أبدًا.-
<p>is a block element — it takes the full width of its container.<p>عنصر كتلة — يأخذ العرض الكامل للحاوية. -
The closing tag
</p>is required in good practice.وسم الإغلاق</p>مطلوب كممارسة جيدة. -
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.لا تضف أزواج<p></p>فارغة لمجرد صنع فراغ — فهذا عمل CSS لا الفقرة.
| Tag | What 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 / جرّب بنفسك
Check yourself / اختبر نفسك
1. Which tag defines a paragraph?
<p> is the paragraph tag. The other three do not exist in HTML.
<p> هو وسم الفقرة، والثلاثة الأخرى غير موجودة في HTML.2. What happens to five spaces in a row inside a paragraph?
The browser collapses any run of whitespace into a single space.
3.
Is it correct to write a <p> inside another <p>?
<p> داخل <p> أخرى؟Paragraphs can never be nested — not once, not for different content. The browser closes the outer <p> automatically the instant it meets the next one.
<p> تلقائيًا بمجرد أن يقابل الفقرة التالية.Score / النتيجة: 0 / 3
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 كل وسم مغلق بشكل صحيح