خاصية محاذاة النص في CSS
مثال
قم بمحاذاة السطر الأخير من النص في ثلاثة عناصر <div>:
div.a
{
text-align: justify; /* For Edge */
text-align-last: right;
}
div.b
{
text-align: justify; /* For Edge */
text-align-last: center;
}
div.c
{
text-align: justify; /* For Edge */
text-align-last: justify;
}
المزيد من الأمثلة "جربها بنفسك" أدناه.
التعريف والاستخدام
text-align-last
تحدد الخاصية كيفية محاذاة السطر الأخير من النص .
لاحظ أن text-align-last
الخاصية تعين المحاذاة لجميع الأسطر الأخيرة داخل العنصر المحدد. لذلك ، إذا كان لديك <div> به ثلاث فقرات ، text-align-last
فسيتم تطبيقه على السطر الأخير من كل فقرات. لاستخدامها text-align-last
في الفقرة الأخيرة فقط في الحاوية ، يمكنك استخدام: آخر طفل ، انظر المثال أدناه.
ملاحظة: في Edge السابق 79 ، text-align-last
تعمل الخاصية فقط على النص الذي يحتوي على "محاذاة النص: ضبط".
القيمة الافتراضية: | تلقاءي |
---|---|
وارث: | نعم |
متحرك: | رقم. اقرأ عن animatable |
الإصدار: | CSS3 |
بناء جملة JavaScript: | الكائن .style.textAlignLast = "right" |
دعم المتصفح
تحدد الأرقام الواردة في الجدول إصدار المتصفح الأول الذي يدعم الخاصية بالكامل.
الأرقام متبوعة بـ -moz- تحدد الإصدار الأول الذي يعمل بالبادئة.
Property | |||||
---|---|---|---|---|---|
text-align-last | 47.0 | 5.5* | 49.0 12.0 -moz- |
Not supported | 34.0 |
* في Internet Explorer 11 (والإصدارات الأقدم) ، لا يتم دعم قيم "البدء" و "النهاية".
بنية CSS
text-align-last: auto|left|right|center|justify|start|end|initial|inherit;
قيم الملكية
Value | Description | Play it |
---|---|---|
auto | Default value. The last line is justified and aligned left | |
left | The last line is aligned to the left | |
right | The last line is aligned to the right | |
center | The last line is center-aligned | |
justify | The last line is justified as the rest of the lines | |
start | The last line is aligned at the beginning of the line (left if the text-direction is left-to-right, and right is the text-direction is right-to-left) | |
end | The last line is aligned at the end of the line (right if the text-direction is left-to-right, and left is the text-direction is right-to-left) | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
مزيد من الأمثلة
مثال
استخدم text-align-last في السطر الأخير فقط في الحاوية:
div.b p:last-child {
text-align-last: center;
}
الصفحات ذات الصلة
دروس CSS: نص CSS
مرجع DOM HTML: خاصية textAlignLast