سمة srcset HTML <source>

❮ علامة HTML <source>

مثال

عنصر <picture> يحتوي على ملفين مصدر وصورة احتياطية:

<picture>
  <source media="(min-width:650px)" srcset="img_pink_flowers.jpg">
  <source media="(min-width:465px)" srcset="img_white_flower.jpg">
  <img src="img_orange_flowers.jpg" alt="Flowers" style="width:auto;">
</picture>

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

تحدد السمة srcsetعنوان URL للصورة لاستخدامه في مواقف مختلفة.

هذه السمة مطلوبة عند <source>استخدامها في <picture>.


دعم المتصفح

تحدد الأرقام الواردة في الجدول إصدار المتصفح الأول الذي يدعم السمة بشكل كامل.

Attribute
srcset 38.0 13.0  38.0 9.1 25.0

بناء الجملة

<source srcset="URL">

قيم السمات

Value Description
URL Specifies the URL of the image.

Possible values:

  • An absolute URL - points to another web site (like href="http://www.example.com/flower.jpg")
  • A relative URL - points to a file within a web site (like href="flower.jpg")

❮ علامة HTML <source>