3.3 KiB
3.3 KiB
id | title | challengeType | guideUrl | videoUrl | localeTitle |
---|---|---|---|---|---|
bad87fee1348bd9aedf08812 | Add Images to Your Website | 0 | https://arabic.freecodecamp.org/guide/certificates/add-images-to-your-website | إضافة الصور إلى موقع الويب الخاص بك |
Description
img
، والإشارة إلى عنوان URL للصورة المحددة باستخدام السمة 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.">
Instructions
img
، قبل عنصر h2
. الآن تعيين السمة src
بحيث يشير إلى هذا العنوان: https://bit.ly/fcc-relaxing-cat
أخيرا لا تنس أن تعطي صورتك نص alt
. Tests
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