Lesson 11 / الدرس 11
Comments / التعليقات
A comment, written <!-- like this -->, is a note the browser skips completely — for notes to yourself and for hiding a piece of code while you test.
التعليق، ويُكتب <!-- هكذا -->، ملاحظة يتجاوزها المتصفح تمامًا — لتدوين ملاحظات لنفسك، ولإخفاء قطعة كود مؤقتًا أثناء الاختبار.
Sometimes you want to leave a note in your file that has nothing to do with the page itself — a reminder for yourself, or for whoever reads this file after you. HTML has a tag for exactly that, and the browser ignores it completely when it draws the page.
<!-- This paragraph introduces the shop -->
<p>We sell dates and honey from local farms.</p>
Two everyday uses
The first use is leaving yourself a note — why a piece of code is written the way it is, or a reminder of what still needs finishing. The second is testing: wrapping a piece of code in a comment hides it from the page without deleting it, so you can bring it back later just by removing the comment.
<h1>Amman Bakery</h1>
<p>Open every day.</p>
<!-- <p>Delivery is temporarily unavailable.</p> -->
What a comment is not
<!--، أول --> تكتبه يُغلقه، حتى لو كنت تقصد إخفاء كتلة تحتوي بداخلها على تعليق آخر. اجعلها قصيرة، ولا تكتب إلا ما يفيد فعلًا من يقرأ الملف بعدك.| Question | Answer |
|---|---|
| Does it show on the page? | No |
| Does it show in "view source"? | Yes |
| Can comments be nested? | No |
What a comment does and does not hide.
Try it live / جرّب بنفسك
Check yourself / اختبر نفسك
1. Does a comment appear on the page the visitor sees?
The browser reads a comment and moves on without drawing anything from it.
2. Can someone see a comment by using "View page source"?
Comments travel to the browser as plain text just like the rest of the file — "View page source" shows them plainly.
3. What should never go inside a comment?
Because comments are visible in the page source, anything private in one is not actually private.
Score / النتيجة: 0 / 3
Your task / مهمتك
Add two comments to a small page: one that explains, for the next reader, why you chose a particular heading; and one that comments out a paragraph so it is still in the file but hidden from the visitor.
أضف تعليقين إلى صفحة صغيرة: تعليق يشرح، لمن يقرأ الملف بعدك، لماذا اخترت عنوانًا معينًا؛ وتعليق يُخفي فقرة بحيث تبقى في الملف لكن لا تظهر للزائر.
- At least one comment that explains something to the next reader تعليق واحد على الأقل يشرح شيئًا لمن يقرأ الملف بعدك
- One paragraph hidden by wrapping it in a comment فقرة واحدة مخفية بإحاطتها بتعليق
- No password or private information inside any comment لا كلمة مرور ولا معلومة خاصة داخل أي تعليق