خاصية ارتفاع خط CSS
مثال
اضبط ارتفاع الخط لعناصر <div> مختلفة:
div.a {
line-height: normal;
}
div.b {
line-height: 1.6;
}
div.c {
line-height:
80%;
}
div.d {
line-height: 200%;
}
المزيد من الأمثلة "جربها بنفسك" أدناه.
التعريف والاستخدام
تحدد الخاصية ارتفاع line-height
الخط.
ملاحظة: القيم السلبية غير مسموح بها.
القيمة الافتراضية: | عادي |
---|---|
وارث: | نعم |
متحرك: | نعم. اقرأ عن animatable |
الإصدار: | CSS1 |
بناء جملة JavaScript: | الكائن .style.lineHeight = "30px" |
دعم المتصفح
تحدد الأرقام الواردة في الجدول إصدار المتصفح الأول الذي يدعم الخاصية بالكامل.
Property | |||||
---|---|---|---|---|---|
line-height | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
بنية CSS
line-height: normal|number|length|initial|inherit;
قيم الملكية
Value | Description | Play it |
---|---|---|
normal | A normal line height. This is default | |
number | A number that will be multiplied with the current font-size to set the line height | |
length | A fixed line height in px, pt, cm, etc. | |
% | A line height in percent of the current font size | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
مزيد من الأمثلة
مثال
عيّن ارتفاع الخط بالبكسل والسنتيمتر لعناصر <div> مختلفة:
div.a {
line-height: 10px;
}
div.b {
line-height: 30px;
}
div.c {
line-height:
0.5cm;
}
div.d {
line-height: 1cm;
}
مثال
عيّن ارتفاع الخط كرقم لعناصر <div> مختلفة:
div.a {
line-height: 0.5;
}
div.b {
line-height: 1.6;
}
div.c {
line-height: 2;
}
الصفحات ذات الصلة
دروس CSS: نص CSS
مرجع DOM HTML: خاصية lineHeight