freeCodeCamp/curriculum/challenges/arabic/01-responsive-web-design/basic-html-and-html5/add-images-to-your-website....

3.3 KiB

id title challengeType videoUrl localeTitle
bad87fee1348bd9aedf08812 Add Images to Your Website 0 إضافة الصور إلى موقع الويب الخاص بك

الوصف

يمكنك إضافة الصور إلى موقع الويب الخاص بك باستخدام العنصر img ، والإشارة إلى رابط الصورة المحددة باستخدام السمة src . مثال على ذلك: <img src="https://www.your-image-source.com/your-image.jpg"> لاحظ أن العنصر img ذاتي الإغلاق. يجب أن تحتوي جميع عناصر img على السمة alt . يستخدم النص داخل السمة alt لقارئات الشاشة لتحسين إمكانية الوصول، ويظهر في حالة فشل تحميل الصورة. ملاحظة: إذا كانت الصورة مزخرفة تمامًا ، فإن استخدام السمة alt بلا نص هو أفضل ممارسة. من الناحية المثالية ، يجب ألا تحتوي السمة alt على أحرف خاصة ما لم تكن هناك حاجة إليها. دعنا نضيف السمة alt إلى مثال العنصر img أعلاه: <img src="https://www.your-image-source.com/your-image.jpg" alt="Author standing on a beach with two thumbs up.">

التعليمات

لنحاول إضافة صورة إلى موقعنا على الويب: إدراج الوسم img ، قبل العنصر h2. الآن قم بتعيين قيمة السمة src بحيث تشير إلى هذا العنوان: https://bit.ly/fcc-relaxing-cat أخيرا لا تنس أن تعطي صورتك نص بديل alt .

الاختبارات

tests:
  - text: يجب أن تحتوي صفحتك على عنصر صورة.
    testString: 'assert($("img").length > 0, "Your page should have an image element.");'
  - text: يجب أن تحتوي صورتك على سمة <code>src</code> تشير إلى صورة القطة الصغيرة.
    testString: 'assert(new RegExp("\/\/bit.ly\/fcc-relaxing-cat|\/\/s3.amazonaws.com\/freecodecamp\/relaxing-cat.jpg", "gi").test($("img").attr("src")), "Your image should have a <code>src</code> attribute that points to the kitten image.");'
  - text: <strong>يجب أن</strong> يحتوي عنصر الصورة على السمة <code>alt</code> .
    testString: 'assert(code.match(/alt\s*?=\s*?(\"|\").*(\"|\")/), "Your image element <strong>must</strong> have an <code>alt</code> attribute.");'

Challenge Seed

<h2>CatPhotoApp</h2>
<main>


  <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
  <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
</main>

Solution

// solution required