0Pricing
Web Accessibility Academy · درس

وضع المحتوى في main واستخدام main واحد فقط

حدّد منطقة المحتوى الأساسية الوحيدة.

وضع المحتوى في main واستخدام main واحد فقط درس مجاني في Web Accessibility Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Web Accessibility Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Web Accessibility Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

main Is the Headline Act

Every page has one star: its unique content. The main element is where that content lives, separate from headers and footers.

One main, Always

A page should have exactly one main landmark. Two mains confuse users, who expect a single primary destination.

What Belongs Inside

Put the page's core content in main: the article, the form, the dashboard. The thing the user actually came for.

<main>
  <h1>Your dashboard</h1>
  <p>Today's stats...</p>
</main>

What Stays Outside

Repeated stuff like the site logo, global nav, and footer links live outside main, since they are not unique to this page.

The Skip-Link Target

A skip link points to main so keyboard users can jump straight to content, past the repeated header on every page.

<a href="#main">Skip to content</a>
<main id="main">...</main>

Make main Focusable

Add tabindex of -1 to main so a skip link can move focus into it without making it tabbable on its own.

<main id="main" tabindex="-1">
  ...
</main>

Two mains, Hidden Rule

If you ever need a second main, all but one must be hidden from view. Only a single visible main is allowed at a time.

Do Not Nest main

The main element cannot live inside article, aside, nav, header, or footer. It sits at the top level of your page body.

The role main Fallback

For very old browsers you can add role of main as a backup, but the native main element is the right modern choice.

<main role="main">...</main>

Why One main Helps

With a single main, screen reader users press one key and land exactly on the content, every page, every time. 🎯

A Clean Page Shape

Header, then nav, then one main, then footer. That predictable shape is what makes a page easy to scan by ear.

Quick Check

How many visible main landmarks should a single page expose?

Recap: One Clear main

You learned to put unique content in a single main, keep repeated parts outside, and use it as the skip-link target. 🙌

الأسئلة الشائعة

هل درس «وضع المحتوى في main واستخدام main واحد فقط» مجاني؟

نعم — نص درس «وضع المحتوى في main واستخدام main واحد فقط» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Web Accessibility Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Web Accessibility Academy 4 دروس في المجموع.

ماذا ستتعلم في «وضع المحتوى في main واستخدام main واحد فقط»؟

حدّد منطقة المحتوى الأساسية الوحيدة. تتمرن على Web Accessibility Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Web Accessibility Academy؟

لا تُشترط خبرة سابقة. Web Accessibility Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.

كم من الوقت يستغرق درس «وضع المحتوى في main واستخدام main واحد فقط»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Web Accessibility Academy هذا؟

نعم. كل درس في Web Accessibility Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. header وnav وmain وfooter: العناصر الأربعة الكبرى
  2. وضع المحتوى في main واستخدام main واحد فقط
  3. تسمية مناطق متعددة باستخدام aria-label
  4. التنقل بين المعالم: كيف يتنقل المستخدمون
← العودة إلى Web Accessibility Academy