صفحة بلغتين / A two-language page

الترتيب / Order
4 من 4 / 4 of 4
آخر تحديث / Updated
8 أكتوبر 2026 / 8 October 2026

أهداف الدرس

  1. أن تبني صفحة تنقلب بين العربية والإنجليزية.
  2. أن تعكس ما يجب عكسه فقط.

ضع dir وlang على <html>، واكتب CSS بالخصائص المنطقية، فينقلب التخطيط وحده.

فيزيائيةمنطقية
margin-leftmargin-inline-start
padding-rightpadding-inline-end
text-align: lefttext-align: start
left: 0inset-inline-start: 0
/* Arrows point the way you read; logos and numbers never flip */
html[dir="rtl"] .icon-arrow { transform: scaleX(-1); }

.title { text-align: start; }

للأسماء والرموز الإنجليزية وسط نص عربي استعمل <bdi> كي لا تنقلب الأقواس والنقاط.

تمرين

هل تُعكس أيقونة «تشغيل» ▶ في العربية؟

الإجابة

لا. هي رمز لاتجاه الزمن في المشغّل، لا لاتجاه القراءة.

Lesson goals

  1. Build a page that flips between Arabic and English.
  2. Mirror only what should be mirrored.

Put dir and lang on <html>, write CSS with logical properties, and the layout flips by itself.

PhysicalLogical
margin-leftmargin-inline-start
padding-rightpadding-inline-end
text-align: lefttext-align: start
left: 0inset-inline-start: 0
/* Arrows point the way you read; logos and numbers never flip */
html[dir="rtl"] .icon-arrow { transform: scaleX(-1); }

.title { text-align: start; }

For English names and codes inside Arabic text use <bdi>, so brackets and dots do not flip.

Exercise

Does a «play» ▶ icon flip in Arabic?

Answer

No. It stands for time moving forward in a player, not reading direction.

التعليقات / Comments

لا تعليقات بعد. كن أول من يسأل. / No comments yet. Be the first to ask.

تعليق الطالب يظهر فوراً، وتعليق الزائر بعد موافقة المدرّس. / A student's comment shows at once; a visitor's once the teacher approves it.

في «تطوير الويب» / In “Web development”

  1. 1HTML بمعنى / Meaningful HTMLفيها كود / has codeالتعليقات مفتوحة / comments open
  2. 2تخطيط CSS / CSS layoutفيها كود / has codeفيها صور / has picturesالتعليقات مفتوحة / comments open
  3. 3JavaScript والبيانات / JavaScript and dataفيها كود / has codeالتعليقات مفتوحة / comments open
  4. 4صفحة بلغتين / A two-language pageفيها كود / has codeالتعليقات مفتوحة / comments open

↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق↑ ↓ to move · Enter to open · Esc to close