سمة النص البديل <img>

❮ علامة HTML <img>

مثال

صورة بنص بديل محدد:

<img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600">

التعريف والاستخدام

تحدد السمة المطلوبة altنصًا بديلاً للصورة ، إذا تعذر عرض الصورة.

توفر altالسمة معلومات بديلة للصورة إذا كان المستخدم لسبب ما لا يمكنه عرضها (بسبب بطء الاتصال ، أو خطأ في srcالسمة ، أو إذا كان المستخدم يستخدم قارئ الشاشة).

نصيحة: لإنشاء تلميح أداة لصورة ، استخدم titleالسمة!


دعم المتصفح

Attribute
alt Yes Yes Yes Yes Yes

بناء الجملة

<img alt="text">

قيم السمات

Value Description
text Specifies an alternate text for an image.

Guidelines for the alt text:

  • The text should describe the image if the image contains information
  • The text should explain where the link goes if the image is inside an <a> element
  • Use alt="" if the image is only for decoration

❮ علامة HTML <img>