خصائص المحتوى المبرر في CSS
مثال
قم بمحاذاة العناصر المرنة في وسط الحاوية:
div
{
display: flex;
justify-content: center;
}
المزيد من الأمثلة "جربها بنفسك" أدناه.
التعريف والاستخدام
تقوم justify-content
الخاصية بمحاذاة عناصر الحاوية المرنة عندما لا تستخدم العناصر كل المساحة المتاحة على المحور الرئيسي (أفقيًا).
نصيحة: استخدم خاصية align-items لمحاذاة العناصر رأسيًا.
القيمة الافتراضية: | بداية مرنة |
---|---|
وارث: | رقم |
متحرك: | رقم. اقرأ عن animatable |
الإصدار: | CSS3 |
بناء جملة JavaScript: | الكائن .style.justifyContent = "مسافة بين" |
دعم المتصفح
تحدد الأرقام الواردة في الجدول إصدار المتصفح الأول الذي يدعم الخاصية بالكامل.
تحدد الأرقام المتبوعة بـ -webkit- أو -moz- الإصدار الأول الذي يعمل مع بادئة.
Property | |||||
---|---|---|---|---|---|
justify-content | 29.0 21.0 -webkit- |
11.0 | 28.0 18.0 -moz- |
9.0 6.1 -webkit- |
17.0 |
بنية CSS
justify-content: flex-start|flex-end|center|space-between|space-around|space-evenly|initial|inherit;
قيم الملكية
Value | Description | Play it |
---|---|---|
flex-start | Default value. Items are positioned at the beginning of the container | |
flex-end | Items are positioned at the end of the container | |
center | Items are positioned in the center of the container | |
space-between | Items will have space between them | |
space-around | Items will have space before, between, and after them | |
space-evenly | Items will have equal space around them | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
مزيد من الأمثلة
مثال
قم بمحاذاة العناصر المرنة في بداية الحاوية (هذا افتراضي):
div
{
display: flex;
justify-content: flex-start;
}
مثال
قم بمحاذاة العناصر المرنة في نهاية الحاوية:
div
{
display: flex;
justify-content: flex-end;
}
مثال
اعرض العناصر المرنة مع ترك مسافة بين السطور:
div
{
display: flex;
justify-content: space-between;
}
مثال
عرض العناصر المرنة بمسافة قبل السطور ، وبينها ، وبعدها:
div
{
display: flex;
justify-content: space-around;
}
الصفحات ذات الصلة
مرجع CSS: خاصية محاذاة المحتوى
مرجع CSS: خاصية محاذاة العناصر
مرجع CSS: align-self property
مرجع DOM HTML: justifyContent property