نمط الخلفية : كرر الخاصية
مثال
اضبط صورة الخلفية على عدم التكرار:
document.body.style.backgroundRepeat = "repeat-y";
المزيد من الأمثلة "جربها بنفسك" أدناه.
التعريف والاستخدام
تقوم الخاصية backgroundRepeat بتعيين أو إرجاع كيفية تكرار (تجانب) صورة خلفية.
دعم المتصفح
تحدد الأرقام الواردة في الجدول إصدار المتصفح الأول الذي يدعم الخاصية بالكامل.
Property | |||||
---|---|---|---|---|---|
backgroundRepeat | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
بناء الجملة
إعادة الخاصية backgroundReat:
object.style.backgroundRepeat
قم بتعيين خاصية backgroundReat:
object.style.backgroundRepeat = "repeat|repeat-x|repeat-y|no-repeat|initial|inherit"
قيم الملكية
Value | Description |
---|---|
repeat | The background image is repeated both vertically and horizontally. This is default |
repeat-x | The background image is only repeated horizontally |
repeat-y | The background image is only repeated vertically |
no-repeat | The background-image is not repeated |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
تفاصيل تقنية
القيمة الافتراضية: | كرر |
---|---|
قيمة الإرجاع: | سلسلة ، تمثل كيفية تكرار صورة الخلفية |
إصدار CSS | CSS1 |
مزيد من الأمثلة
مثال
تغيير خاصية backgroundRepeat لعنصر DIV محدد:
document.getElementById("myDIV").style.backgroundRepeat = "repeat-x";
مثال
اضبط صورة الخلفية لتكرارها أفقيًا أو رأسيًا:
function repeatVer()
{
document.body.style.backgroundRepeat = "repeat-y";
}
function repeatHor() {
document.body.style.backgroundRepeat = "repeat-x";
}
مثال
إرجاع قيمة تكرار الخلفية للمستند:
alert(document.body.style.backgroundRepeat);
الصفحات ذات الصلة
دروس CSS: خلفية CSS
مرجع CSS: خاصية وضع الخلفية
مرجع CSS: خاصية تكرار الخلفية
مرجع DOM HTML: خاصية الخلفية