Dòng phong cách
Thí dụ
Đặt chiều cao dòng cho phần tử <div>:
document.getElementById("myDiv").style.lineHeight = "3";
Định nghĩa và Cách sử dụng
Thuộc tính lineHeight đặt hoặc trả về khoảng cách giữa các dòng trong văn bản.
Hỗ trợ trình duyệt
Property | |||||
---|---|---|---|---|---|
lineHeight | Yes | Yes | Yes | Yes | Yes |
Cú pháp
Trả về thuộc tính lineHeight:
object.style.lineHeight
Đặt thuộc tính lineHeight:
object.style.lineHeight = "normal|number|length|%|initial|inherit"
Giá trị tài sản
Value | Description |
---|---|
normal | Normal line height is used. This is default |
number | A number that will be multiplied with the current font size to set the line height |
length | Defines the line height in length units |
% | Defines the line height in % 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 |
Chi tiết kỹ thuật
Giá trị mặc định: | thông thường |
---|---|
Giá trị trả lại: | Một chuỗi, đại diện cho khoảng cách giữa các dòng trong văn bản |
Phiên bản CSS | CSS1 |
Các ví dụ khác
Thí dụ
Trả về chiều cao dòng của phần tử <div>:
alert(document.getElementById("myDiv").style.lineHeight);
Các trang liên quan
Hướng dẫn CSS: Văn bản CSS
Tham chiếu CSS: thuộc tính line-height
❮ Đối tượng phong cách